비즈니스 로그 구조 생성
서비스별 비즈니스 로그 처리 코드 정리
This commit is contained in:
@@ -4,40 +4,81 @@ import com.caliverse.admin.domain.RabbitMq.message.LogoutReasonType;
|
||||
import com.caliverse.admin.domain.RabbitMq.message.MailItem;
|
||||
import com.caliverse.admin.domain.RabbitMq.message.OperationSystemMessage;
|
||||
import com.caliverse.admin.domain.RabbitMq.message.ServerMessage;
|
||||
import com.caliverse.admin.domain.entity.log.LogStatus;
|
||||
import com.caliverse.admin.global.common.constants.CommonConstants;
|
||||
import com.caliverse.admin.global.common.utils.CommonUtils;
|
||||
import com.caliverse.admin.mongodb.service.BusinessLogService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class MessageHandlerService {
|
||||
|
||||
private final RabbitMqService rabbitMqService;
|
||||
private final BusinessLogService businessLogService;
|
||||
|
||||
public MessageHandlerService(RabbitMqService rabbitMqService) {
|
||||
public MessageHandlerService(RabbitMqService rabbitMqService, BusinessLogService businessLogService) {
|
||||
this.rabbitMqService = rabbitMqService;
|
||||
this.businessLogService = businessLogService;
|
||||
}
|
||||
|
||||
private void logMessage(LogStatus logStatus, String message, String queName, String serverName, Object content){
|
||||
CompletableFuture<String> logFuture = businessLogService.logMessageQueue(
|
||||
logStatus,
|
||||
message,
|
||||
CommonUtils.getAdmin() == null ? CommonConstants.SYSTEM : CommonUtils.getAdmin().getEmail(),
|
||||
CommonUtils.getClientIp() == null ? CommonConstants.SYSTEM : CommonUtils.getClientIp(),
|
||||
queName,
|
||||
serverName,
|
||||
content
|
||||
);
|
||||
|
||||
logFuture.whenComplete((result, throwable) -> {
|
||||
if (throwable != null) {
|
||||
log.warn("MessageQueue Business log failed for info: {}, error: {}", CommonUtils.objectByString(content), throwable.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void sendUserKickMessage(String userGuid, String serverName, String reason){
|
||||
try {
|
||||
var user_kick_builder = ServerMessage.MOS2GS_NTF_USER_KICK.newBuilder();
|
||||
user_kick_builder.setUserGuid(userGuid);
|
||||
user_kick_builder.setKickReasonMsg(String.format("backoffice %s", reason));
|
||||
user_kick_builder.setLogoutReasonType(LogoutReasonType.LogoutReasonType_None);
|
||||
|
||||
rabbitMqService.SendMessage(user_kick_builder.build(), serverName);
|
||||
|
||||
logMessage(
|
||||
LogStatus.SUCCESS,
|
||||
"",
|
||||
"sendUserKickMessage",
|
||||
serverName,
|
||||
user_kick_builder
|
||||
);
|
||||
}catch(Exception e){
|
||||
log.error(e.getMessage());
|
||||
logMessage(
|
||||
LogStatus.FAILURE,
|
||||
String.format("User Kick Fail UserGuid: %s, reason: %s, error: %s", userGuid, reason, e.getMessage()),
|
||||
"sendUserKickMessage",
|
||||
serverName,
|
||||
null
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public void sendNoticeMessage(List<String> serverList, String type, List<OperationSystemMessage> msgList, List<OperationSystemMessage> senderList){
|
||||
try {
|
||||
var noticeBuilder = ServerMessage.MOS2GS_NTF_NOTICE_CHAT.newBuilder();
|
||||
noticeBuilder.addNoticeType(type);
|
||||
// noticeBuilder.setNoticeType(0, type);
|
||||
// int msgIdx = 0;
|
||||
|
||||
for (OperationSystemMessage msg : msgList) {
|
||||
noticeBuilder.addChatMessage(msg);
|
||||
// noticeBuilder.setChatMessage(msgIdx, msg);
|
||||
// msgIdx++;
|
||||
}
|
||||
for (OperationSystemMessage sender : senderList) {
|
||||
noticeBuilder.addSender(sender);
|
||||
@@ -45,50 +86,117 @@ public class MessageHandlerService {
|
||||
for (String server : serverList) {
|
||||
rabbitMqService.SendMessage(noticeBuilder.build(), server);
|
||||
}
|
||||
logMessage(
|
||||
LogStatus.SUCCESS,
|
||||
"",
|
||||
"sendNoticeMessage",
|
||||
serverList.toString(),
|
||||
noticeBuilder
|
||||
);
|
||||
}catch (Exception e){
|
||||
log.error(e.getMessage());
|
||||
logMessage(
|
||||
LogStatus.FAILURE,
|
||||
String.format("Send Notice Fail Type: %s, senderList: %s, msgList: %s, error: %s", type, senderList.toString(), msgList.toString(), e.getMessage()),
|
||||
"sendNoticeMessage",
|
||||
serverList.toString(),
|
||||
null
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public void sendMailMessage(String serverName, String userGuid, String mailType, List<OperationSystemMessage> titleList, List<OperationSystemMessage> msgList
|
||||
, List<MailItem> itemList, List<OperationSystemMessage> senderList){
|
||||
try {
|
||||
var mail_builder = ServerMessage.MOS2GS_NTF_MAIL_SEND.newBuilder();
|
||||
mail_builder.setUserGuid(userGuid);
|
||||
mail_builder.setMailType(mailType);
|
||||
|
||||
for(OperationSystemMessage title : titleList){
|
||||
for (OperationSystemMessage title : titleList) {
|
||||
mail_builder.addTitle(title);
|
||||
}
|
||||
for(OperationSystemMessage msg : msgList){
|
||||
for (OperationSystemMessage msg : msgList) {
|
||||
mail_builder.addMsg(msg);
|
||||
}
|
||||
for(MailItem item : itemList){
|
||||
for (MailItem item : itemList) {
|
||||
mail_builder.addItemList(item);
|
||||
}
|
||||
for(OperationSystemMessage sender : senderList){
|
||||
for (OperationSystemMessage sender : senderList) {
|
||||
mail_builder.addSender(sender);
|
||||
}
|
||||
rabbitMqService.SendMessage(mail_builder.build(), serverName);
|
||||
|
||||
logMessage(
|
||||
LogStatus.SUCCESS,
|
||||
"",
|
||||
"sendMailMessage",
|
||||
serverName,
|
||||
mail_builder
|
||||
);
|
||||
}catch (Exception e){
|
||||
log.error(e.getMessage());
|
||||
logMessage(
|
||||
LogStatus.FAILURE,
|
||||
String.format("Send Mail Fail UserGuid: %s, mailType: %s, senderList: %s, titleList: %s, itemList: %s, error: %s",
|
||||
userGuid, mailType, senderList.toString(), titleList.toString(), itemList.toString(), e.getMessage()),
|
||||
"sendMailMessage",
|
||||
serverName,
|
||||
null
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public void sendBannerMessage(String serverName){
|
||||
try {
|
||||
var banner_builder = ServerMessage.MOS2GS_NTF_UPDATE_BANNER.newBuilder();
|
||||
|
||||
rabbitMqService.SendMessage(banner_builder.build(), serverName);
|
||||
|
||||
logMessage(
|
||||
LogStatus.SUCCESS,
|
||||
"",
|
||||
"sendBannerMessage",
|
||||
serverName,
|
||||
banner_builder
|
||||
);
|
||||
}catch(Exception e){
|
||||
log.error(e.getMessage());
|
||||
logMessage(
|
||||
LogStatus.FAILURE,
|
||||
String.format("Banner Fail error: %s", e.getMessage()),
|
||||
"sendBannerMessage",
|
||||
serverName,
|
||||
null
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public void sendQuestTaskCompleteMessage(String serverName, String accountId, int reqId, String questKey, int taskId){
|
||||
try {
|
||||
var quest_task_builder = ServerMessage.MOS2GS_NTF_QUEST_TASK_FORCE_COMPLETE.newBuilder();
|
||||
quest_task_builder.setAccountId(accountId);
|
||||
quest_task_builder.setReqId(reqId);
|
||||
quest_task_builder.setQuestKey(questKey);
|
||||
quest_task_builder.setTaskId(taskId);
|
||||
|
||||
|
||||
rabbitMqService.SendMessage(quest_task_builder.build(), serverName);
|
||||
|
||||
logMessage(
|
||||
LogStatus.SUCCESS,
|
||||
"",
|
||||
"sendQuestTaskCompleteMessage",
|
||||
serverName,
|
||||
quest_task_builder
|
||||
);
|
||||
}catch(Exception e){
|
||||
log.error(e.getMessage());
|
||||
logMessage(
|
||||
LogStatus.FAILURE,
|
||||
String.format("Quest Task Complete Fail accountId: %s, questKey: %s, taskId: %s, error: %s", accountId, questKey, taskId, e.getMessage()),
|
||||
"sendQuestTaskCompleteMessage",
|
||||
serverName,
|
||||
null
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
package com.caliverse.admin.domain.adminlog;
|
||||
|
||||
import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
|
||||
|
||||
public class AdminItemDeleteLog extends AdminLogBase {
|
||||
|
||||
public AdminItemDeleteLog(String userGuid, String itemGuid, String itemCount){
|
||||
super(HISTORYTYPEDETAIL.USER_ITEM_DELETE);
|
||||
|
||||
var jsonObject = getJsonContentObject();
|
||||
|
||||
jsonObject.put("userGuid", userGuid);
|
||||
jsonObject.put("itemGuid", itemGuid);
|
||||
jsonObject.put("itemCount", itemCount);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,76 +0,0 @@
|
||||
package com.caliverse.admin.domain.adminlog;
|
||||
|
||||
|
||||
import com.caliverse.admin.domain.dao.admin.HistoryMapper;
|
||||
import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
|
||||
import com.caliverse.admin.global.common.utils.CommonUtils;
|
||||
import com.caliverse.admin.global.component.AdminApplicationContextProvider;
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.json.JSONObject;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@Slf4j
|
||||
public abstract class AdminLogBase implements IAdminLog{
|
||||
|
||||
|
||||
private final HistoryMapper historyMapper;
|
||||
private static ApplicationContext context;
|
||||
|
||||
private final HISTORYTYPEDETAIL historyType;
|
||||
|
||||
protected Map<String, Object> map;
|
||||
|
||||
@Getter
|
||||
protected JSONObject jsonContentObject = new JSONObject();
|
||||
|
||||
|
||||
public AdminLogBase(HISTORYTYPEDETAIL historyType) {
|
||||
|
||||
this.historyMapper = AdminApplicationContextProvider.getContext().getBean(HistoryMapper.class);
|
||||
this.historyType = historyType;
|
||||
|
||||
jsonContentObject = new JSONObject();
|
||||
this.map = new HashMap<>();
|
||||
|
||||
makeDefaultMap();
|
||||
}
|
||||
|
||||
//protected abstract void saveAdminLog();
|
||||
|
||||
|
||||
private void makeDefaultMap(){
|
||||
|
||||
|
||||
Long adminId = 0L;
|
||||
String adminName = "";
|
||||
String adminMail = "";
|
||||
HISTORYTYPEDETAIL type = HISTORYTYPEDETAIL.NONE;
|
||||
try {
|
||||
adminId = CommonUtils.getAdmin().getId();
|
||||
adminName = CommonUtils.getAdmin().getName();
|
||||
adminMail = CommonUtils.getAdmin().getEmail();
|
||||
}
|
||||
catch (Exception e){
|
||||
log.error("makeDefaultMap getAdmin() null error message : {}", e.getMessage());
|
||||
}
|
||||
|
||||
this.map.put("adminId", adminId);
|
||||
this.map.put("name", adminName);
|
||||
this.map.put("mail", adminMail);
|
||||
this.map.put("type", historyType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveLogToDB(){
|
||||
this.map.put("content", jsonContentObject.toString());
|
||||
historyMapper.saveLog(map);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package com.caliverse.admin.domain.adminlog;
|
||||
|
||||
import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
|
||||
|
||||
public class AdminLoginPermitLog extends AdminLogBase {
|
||||
|
||||
public AdminLoginPermitLog() {
|
||||
super(HISTORYTYPEDETAIL.LOGIN_PERMITTED);
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package com.caliverse.admin.domain.adminlog;
|
||||
|
||||
|
||||
import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
|
||||
|
||||
public class AdminPasswordInitLog extends AdminLogBase {
|
||||
|
||||
public AdminPasswordInitLog(String name, String email) {
|
||||
super(HISTORYTYPEDETAIL.PASSWORD_INIT);
|
||||
|
||||
var jsonObject = getJsonContentObject();
|
||||
|
||||
jsonObject.put("name", name);
|
||||
jsonObject.put("email", email);
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package com.caliverse.admin.domain.adminlog;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface IAdminLog {
|
||||
|
||||
public void saveLogToDB();
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package com.caliverse.admin.domain.batch;
|
||||
|
||||
import org.springframework.batch.item.ItemProcessor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
public class CustomProcessor implements ItemProcessor<String, String> {
|
||||
|
||||
@Override
|
||||
public String process(String data) throws Exception {
|
||||
log.info("Processing data: " + data);
|
||||
//data = data.toUpperCase();
|
||||
|
||||
return data;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
package com.caliverse.admin.domain.batch;
|
||||
|
||||
import org.springframework.batch.item.ItemReader;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
public class CustomReader implements ItemReader<String> {
|
||||
private String[] tokens = { "Hello World!", "Hello Spring!", "Hello Batch!" };
|
||||
private int index = 0;
|
||||
|
||||
@Override
|
||||
public String read() throws Exception {
|
||||
if (index >= tokens.length) {
|
||||
return null;
|
||||
}
|
||||
|
||||
String data = index + " " + tokens[index];
|
||||
index++;
|
||||
|
||||
log.info("reading data: {}", data);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package com.caliverse.admin.domain.batch;
|
||||
|
||||
import org.springframework.batch.item.Chunk;
|
||||
import org.springframework.batch.item.ItemWriter;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
public class CustomWriter implements ItemWriter<String> {
|
||||
@Override
|
||||
public void write(Chunk<? extends String> chunk) throws Exception {
|
||||
|
||||
for (String data : chunk) {
|
||||
log.info("Writing item: " + data.toString());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
package com.caliverse.admin.domain.batch;
|
||||
|
||||
// import org.springframework.batch.core.Job;
|
||||
// import org.springframework.batch.core.JobExecutionException;
|
||||
// import org.springframework.batch.core.JobParameters;
|
||||
// import org.springframework.batch.core.JobParametersBuilder;
|
||||
// import org.springframework.batch.core.Step;
|
||||
// import org.springframework.batch.core.job.builder.JobBuilder;
|
||||
// import org.springframework.batch.core.launch.JobLauncher;
|
||||
// import org.springframework.batch.core.repository.JobRepository;
|
||||
// import org.springframework.batch.core.step.builder.StepBuilder;
|
||||
// import org.springframework.batch.core.step.tasklet.Tasklet;
|
||||
// import org.springframework.batch.repeat.RepeatStatus;
|
||||
//import org.springframework.context.annotation.Bean;
|
||||
//import org.springframework.context.annotation.Configuration;
|
||||
//import org.springframework.transaction.PlatformTransactionManager;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
//@Configuration
|
||||
//@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
@Getter
|
||||
public class TestJob {
|
||||
|
||||
// private final JobLauncher jobLauncher;
|
||||
// private final PlatformTransactionManager transactionManager;
|
||||
|
||||
|
||||
// @Bean
|
||||
// public Job testSimpleJob(PlatformTransactionManager transactionManager, JobRepository jobRepository) {
|
||||
// return new JobBuilder("testSimpleJob", jobRepository)
|
||||
// .start(testSimpleStep(transactionManager, jobRepository))
|
||||
// .build();
|
||||
// }
|
||||
|
||||
// @Bean
|
||||
// public Step testSimpleStep(PlatformTransactionManager transactionManager, JobRepository jobRepository) {
|
||||
|
||||
// return new StepBuilder("testSimpleStep", jobRepository)
|
||||
// .tasklet(testTasklet(), transactionManager)
|
||||
// .build();
|
||||
// }
|
||||
|
||||
// public Tasklet testTasklet() {
|
||||
// return (contribution, chunkContext) -> {
|
||||
// log.info("test job runned");
|
||||
// return RepeatStatus.FINISHED;
|
||||
// };
|
||||
// }
|
||||
|
||||
// public void runJob() {
|
||||
// try {
|
||||
// JobParameters jobParameters = new JobParametersBuilder()
|
||||
// .addLong("run.id", System.currentTimeMillis())
|
||||
// .toJobParameters();
|
||||
// jobLauncher.run(testSimpleJob(transactionManager, null), jobParameters);
|
||||
// } catch (JobExecutionException e) {
|
||||
// log.error("Failed to execute job", e);
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import com.caliverse.admin.domain.entity.STATUS;
|
||||
|
||||
public interface AdminMapper {
|
||||
Optional<Admin> findByEmail(String email);
|
||||
Optional<Admin> findById(Long id);
|
||||
|
||||
boolean existsByEmail(String email);
|
||||
|
||||
@@ -18,7 +19,6 @@ public interface AdminMapper {
|
||||
|
||||
void initPwd(String password,Long id, Long updateBy);
|
||||
void updatePwd(String password, Long updateBy, STATUS status);
|
||||
void saveHistoryPwd(String password,Long adminId);
|
||||
|
||||
//운영자 리스트 조회
|
||||
List<Admin> getAdminList(Map<String, String> requestMap);
|
||||
|
||||
@@ -21,7 +21,7 @@ public interface GroupMapper {
|
||||
int findGroupName(String groupNm);
|
||||
int getAllCnt();
|
||||
// 권한 등록
|
||||
void postAdminGroup(GroupRequest groupRequest);
|
||||
void postGroup(GroupRequest groupRequest);
|
||||
|
||||
//group_auth 테이블 삭제 by groupId
|
||||
void deleteGroupAuth(String groupId);
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
package com.caliverse.admin.domain.dao.admin;
|
||||
|
||||
import com.caliverse.admin.domain.entity.Log;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface HistoryMapper {
|
||||
// 사용 이력 리스트 조회
|
||||
List<Log> getHistoryList(Map map);
|
||||
|
||||
//전체 데이터 count
|
||||
int getAllCnt(Map map);
|
||||
int getTotal();
|
||||
String getLogJson(String id);
|
||||
void saveLog(Map map);
|
||||
|
||||
//임시로 Meta Data를 넣기 위한 Mepper
|
||||
void truncateMetaTable();
|
||||
void insertMetaData(Map map);
|
||||
|
||||
}
|
||||
@@ -1,11 +1,8 @@
|
||||
package com.caliverse.admin.domain.dao.admin;
|
||||
|
||||
import com.caliverse.admin.domain.entity.Event;
|
||||
import com.caliverse.admin.domain.entity.LandAuction;
|
||||
import com.caliverse.admin.domain.entity.LandOwnerChange;
|
||||
import com.caliverse.admin.domain.entity.Message;
|
||||
import com.caliverse.admin.domain.request.LandRequest;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -24,8 +21,6 @@ public interface LandMapper {
|
||||
LandOwnerChange getLandOwnerChangeDetail(Long id);
|
||||
List<LandOwnerChange> getLandOwnerChangeInfo(int landId);
|
||||
|
||||
List<Message> getMessage(Long id);
|
||||
|
||||
int getMaxLandSeq(Integer landId);
|
||||
int getPossibleLand(Integer landId);
|
||||
int getPossibleLandOwnerChanges(Integer landId);
|
||||
@@ -33,11 +28,9 @@ public interface LandMapper {
|
||||
int postLandAuction(LandRequest landRequest);
|
||||
int postLandOwnerChange(LandRequest landRequest);
|
||||
|
||||
void insertMessage(Map map);
|
||||
int updateLandAuction(LandRequest landRequest);
|
||||
int updateLandOwnerChange(LandRequest landRequest);
|
||||
|
||||
int deleteMessage(Map map);
|
||||
int initLandAuction(Long id);
|
||||
int initLandOwnedChanges(Long id);
|
||||
|
||||
|
||||
@@ -58,6 +58,7 @@ public class Admin implements UserDetails{
|
||||
private LocalDateTime updateDt;
|
||||
@JsonProperty("update_by")
|
||||
private String updateBy;
|
||||
private boolean deleted;
|
||||
|
||||
@Override
|
||||
public Collection<? extends GrantedAuthority> getAuthorities() {
|
||||
|
||||
@@ -14,6 +14,7 @@ public enum EMetaData {
|
||||
GAME_MODE_DATA("GameMode", true),
|
||||
GAME_MODE_FFA_DATA("GameModeTpsFfa", true),
|
||||
GAME_MODE_TDM_DATA("GameModeTpsTdm", true),
|
||||
GAME_MODE_MATCH_DATA("GameModeMatch", true),
|
||||
BATTLE_CONFIG_DATA("BattleFFAConfig", true),
|
||||
BATTLE_REWARD_DATA("BattleFFAReward", true),
|
||||
SYSTEM_MAIL_DATA("SystemMail", true)
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.caliverse.admin.domain.entity;
|
||||
|
||||
public enum EReqType {
|
||||
MAIL("MAIL"),
|
||||
NOTICE("NOTICE"),
|
||||
QUEST_TASK("QUEST_TASK");
|
||||
|
||||
private final String value;
|
||||
|
||||
EReqType(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.caliverse.admin.domain.adminlog;
|
||||
package com.caliverse.admin.domain.entity;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.caliverse.admin.domain.entity;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
@@ -57,6 +58,10 @@ public class InGame {
|
||||
@JsonProperty("send_status")
|
||||
private SENDSTATUS sendStatus;
|
||||
|
||||
@JsonProperty("message_list")
|
||||
List<Message> messageList;
|
||||
|
||||
private boolean deleted;
|
||||
// 수정자 이메일주소
|
||||
@JsonProperty("update_by")
|
||||
private String updateBy;
|
||||
|
||||
@@ -60,6 +60,7 @@ public class Mail {
|
||||
// 단일 / 복수 -> guid / 엑셀 경로
|
||||
private String target;
|
||||
|
||||
private boolean deleted;
|
||||
@JsonProperty("create_by")
|
||||
private String createBy;
|
||||
@JsonProperty("create_dt")
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.caliverse.admin.domain.entity.common;
|
||||
|
||||
public interface BeforeDataResolver {
|
||||
Object resolveBeforeData(Object parameter);
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.caliverse.admin.domain.entity.log;
|
||||
|
||||
public enum LogAction {
|
||||
UNKNOWN,
|
||||
|
||||
// 특화
|
||||
LOGIN,
|
||||
LOGOUT,
|
||||
UPLOAD,
|
||||
DOWNLOAD,
|
||||
CONNECT,
|
||||
DISCONNECT,
|
||||
START,
|
||||
STOP,
|
||||
PAUSE,
|
||||
RESUME,
|
||||
RETRY,
|
||||
CANCEL,
|
||||
|
||||
KICK_USER,
|
||||
ADMIN_LEVEL,
|
||||
NICKNAME_CHANGE,
|
||||
MAIL_ITEM,
|
||||
QUEST_TASK,
|
||||
|
||||
SCHEDULE_CLEANUP,
|
||||
SCHEDULE_DATA_INIT,
|
||||
SCHEDULE_LAND_OWNER_CHANGE,
|
||||
SCHEDULE_BLACK_LIST,
|
||||
SCHEDULE_NOTICE,
|
||||
SCHEDULE_MAIL,
|
||||
SCHEDULE_EVENT,
|
||||
SCHEDULE_BATTLE_EVENT,
|
||||
SCHEDULE_LAND_AUCTION,
|
||||
|
||||
// 파일
|
||||
COMPRESS,
|
||||
EXTRACT,
|
||||
BACKUP,
|
||||
RESTORE,
|
||||
|
||||
BANNER,
|
||||
BATTLE_EVENT,
|
||||
BUILDING,
|
||||
LAND_OWNER_CHANGE,
|
||||
LAND_AUCTION,
|
||||
GROUP,
|
||||
ADMIN,
|
||||
ADMIN_GROUP,
|
||||
ADMIN_DELETE,
|
||||
AUTH_ADMIN,
|
||||
PASSWORD_INIT,
|
||||
PASSWORD_CHANGE,
|
||||
BLACK_LIST,
|
||||
CALIUM_REQUEST,
|
||||
EVENT,
|
||||
MAIL,
|
||||
NOTICE,
|
||||
DATA_INIT,
|
||||
DATA,
|
||||
USER,
|
||||
ITEM
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.caliverse.admin.domain.entity.log;
|
||||
|
||||
public enum LogCategory {
|
||||
SCHEDULER,
|
||||
MAIL,
|
||||
NOTICE,
|
||||
DYNAMODB,
|
||||
MARIADB,
|
||||
MESSAGE_QUEUE,
|
||||
REDIS,
|
||||
S3,
|
||||
USER_MANAGEMENT,
|
||||
EXTERNAL_API,
|
||||
BATCH_JOB,
|
||||
AUTHENTICATION,
|
||||
AUTHORIZATION,
|
||||
FILE_PROCESSING,
|
||||
VALIDATION,
|
||||
DATA_INIT,
|
||||
;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.caliverse.admin.domain.entity.log;
|
||||
|
||||
public enum LogStatus {
|
||||
SUCCESS,
|
||||
FAILURE,
|
||||
PENDING,
|
||||
RUNNING,
|
||||
CANCELLED,
|
||||
TIMEOUT,
|
||||
RETRY,
|
||||
PARTIAL_SUCCESS,
|
||||
WARNING
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.caliverse.admin.domain.entity.metaEnum;
|
||||
|
||||
|
||||
import com.caliverse.admin.domain.entity.common.ValueEnum;
|
||||
|
||||
public enum EGameModeType implements ValueEnum {
|
||||
None(0),
|
||||
TPS_FFA(1),
|
||||
TPS_TDM(2),
|
||||
RUN_ADV(3),
|
||||
RUN_RACE(4),
|
||||
DANCE(5)
|
||||
;
|
||||
|
||||
private final int value;
|
||||
|
||||
EGameModeType(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getValue() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.caliverse.admin.domain.entity.metaEnum;
|
||||
|
||||
public enum EJoinInProgressType {
|
||||
None,
|
||||
JoinIn,
|
||||
JoinInSnapShot,
|
||||
ReEntry
|
||||
;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.caliverse.admin.domain.entity.metaEnum;
|
||||
|
||||
public enum ETeamAssignmentType {
|
||||
Random,
|
||||
Greedy,
|
||||
;
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.caliverse.admin.domain.entity.metadata;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.swagger.v3.oas.models.security.SecurityScheme;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
|
||||
@Getter @Setter
|
||||
public class MetaGameModeCommonData {
|
||||
private Integer id;
|
||||
private String desc;
|
||||
@JsonProperty("ax_start_wait_time")
|
||||
private Integer axStartWaitTime;
|
||||
@JsonProperty("proceed_if_no_enemies")
|
||||
private boolean proceedIfNoEnemies;
|
||||
@JsonProperty("max_play_time")
|
||||
private Integer maxPlayTime;
|
||||
@JsonProperty("character_base_stat_data_id")
|
||||
private Integer characterBaseStatDataID;
|
||||
@JsonProperty("character_attribute_stat_data_id")
|
||||
private Integer characterAttributeStatDataID;
|
||||
@JsonProperty("character_ability_level_data_id")
|
||||
private Integer characterAbilityLevelDataID;
|
||||
@JsonProperty("attribute_func_data_id_ue")
|
||||
private String attributeFuncDataID_UE;
|
||||
@JsonProperty("genre_name")
|
||||
private String genreName;
|
||||
@JsonProperty("mode_name")
|
||||
private String modeName;
|
||||
@JsonProperty("map_name")
|
||||
private String mapName;
|
||||
@JsonProperty("map_description")
|
||||
private String mapDescription;
|
||||
@JsonProperty("map_image")
|
||||
private String mapImage;
|
||||
@JsonProperty("map_tooltip_group_id")
|
||||
private Integer mapTooltipGroupID;
|
||||
@JsonProperty("guide_url")
|
||||
private String guideUrl;
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.caliverse.admin.domain.entity.metadata;
|
||||
import com.caliverse.admin.domain.entity.metaEnum.EJoinInProgressType;
|
||||
import com.caliverse.admin.domain.entity.metaEnum.ETeamAssignmentType;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Getter @Setter
|
||||
public class MetaGameModeMatchData {
|
||||
private Integer id;
|
||||
private String desc;
|
||||
@JsonProperty("mmr_check")
|
||||
private boolean mmrCheck;
|
||||
@JsonProperty("party_match_player_count_able_array")
|
||||
private List<Integer> partyMatchPlayerCountAbleArray;
|
||||
@JsonProperty("match_wait_time_sec")
|
||||
private Integer matchWaitTimeSec;
|
||||
@JsonProperty("game_mode_mmr_id")
|
||||
private Integer gameModeMmrID;
|
||||
@JsonProperty("match_retry_count")
|
||||
private Integer matchRetryCount;
|
||||
@JsonProperty("mmr_expansion_phase")
|
||||
private Integer mmrExpansionPhase;
|
||||
@JsonProperty("team_assignment")
|
||||
private ETeamAssignmentType teamAssignment;
|
||||
@JsonProperty("join_in_progress")
|
||||
private EJoinInProgressType joinInProgress;
|
||||
@JsonProperty("join_in_max_time_sec")
|
||||
private Integer joinInMaxTimeSec;
|
||||
@JsonProperty("entrance_closing_time")
|
||||
private Integer entranceClosingTime;
|
||||
}
|
||||
@@ -47,8 +47,6 @@ public class LandRequest {
|
||||
//경매 시작가
|
||||
@JsonProperty("start_price")
|
||||
private Double startPrice;
|
||||
@JsonProperty("message_list")
|
||||
private List<Message> massageList;
|
||||
|
||||
//소유권 변경
|
||||
@JsonProperty("user_guid")
|
||||
|
||||
@@ -57,7 +57,7 @@ public class NoticeRequest {
|
||||
|
||||
@Getter
|
||||
public static class MessageId{
|
||||
@JsonProperty("message_id")
|
||||
private Long messageId;
|
||||
@JsonProperty("id")
|
||||
private Long id;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.caliverse.admin.domain.response;
|
||||
|
||||
import com.caliverse.admin.domain.entity.BattleEvent;
|
||||
import com.caliverse.admin.domain.entity.metadata.MetaBattleConfigData;
|
||||
import com.caliverse.admin.domain.entity.metadata.MetaBattleRewardData;
|
||||
import com.caliverse.admin.domain.entity.metadata.MetaGameModeData;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class GameResponse {
|
||||
private int status;
|
||||
|
||||
private String result;
|
||||
@JsonProperty("data")
|
||||
private ResultData resultData;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public static class ResultData {
|
||||
|
||||
@JsonProperty("event_detail")
|
||||
private BattleEvent battleEvent;
|
||||
|
||||
@JsonProperty("event_list")
|
||||
private List<BattleEvent> battleEventList;
|
||||
|
||||
@JsonProperty("battle_config_list")
|
||||
private List<MetaBattleConfigData> battleConfigList;
|
||||
|
||||
@JsonProperty("battle_reward_list")
|
||||
private List<MetaBattleRewardData> battleRewardList;
|
||||
|
||||
@JsonProperty("game_mode_list")
|
||||
private List<MetaGameModeData> gameModeList;
|
||||
|
||||
private String message;
|
||||
|
||||
private int total;
|
||||
@JsonProperty("total_all")
|
||||
private int totalAll;
|
||||
@JsonProperty("page_no")
|
||||
private int pageNo;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -64,7 +64,7 @@ public class AIService {
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new RuntimeException("JSON 변환 실패", e);
|
||||
}
|
||||
messages.add(CommonUtils.getAIMessage(AIRole.user, messageMerge(userMessage, dataJson)));
|
||||
messages.add(getAIMessage(AIRole.user, messageMerge(userMessage, dataJson)));
|
||||
|
||||
return messages;
|
||||
}
|
||||
@@ -75,7 +75,7 @@ public class AIService {
|
||||
|
||||
private List<Map<String,String>> initMessage(){
|
||||
List<Map<String,String>> messages = new ArrayList<>();
|
||||
messages.add(CommonUtils.getAIMessage(AIRole.system,
|
||||
messages.add(getAIMessage(AIRole.system,
|
||||
"""
|
||||
너는 프론트엔드 게시용 데이터를 생성하는 게임 데이터 분석 AI야. \
|
||||
사용자는 게임 로그 데이터와 함께 다양한 질문을 보낼 수 있어. \
|
||||
@@ -97,7 +97,7 @@ public class AIService {
|
||||
switch (type){
|
||||
case BUSINESS_LOG -> {
|
||||
LogGenericRequest logReq = mapper.convertValue(conditions, LogGenericRequest.class);
|
||||
List<GenericMongoLog> logs = businessLogGenericService.loadBusinessLogData(logReq, GenericMongoLog.class, true);
|
||||
List<GenericMongoLog> logs = businessLogGenericService.loadBusinessLogData(logReq, GenericMongoLog.class);
|
||||
return logs;
|
||||
}
|
||||
case MAIL -> {
|
||||
@@ -107,4 +107,8 @@ public class AIService {
|
||||
default -> throw new RuntimeException("Not Type");
|
||||
}
|
||||
}
|
||||
|
||||
private static Map<String, String> getAIMessage(AIRole role, String message){
|
||||
return Map.of("role", role.toString(), "content", message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,24 +1,22 @@
|
||||
package com.caliverse.admin.domain.service;
|
||||
|
||||
import com.caliverse.admin.domain.adminlog.AdminPasswordInitLog;
|
||||
import com.caliverse.admin.domain.adminlog.IAdminLog;
|
||||
import com.caliverse.admin.domain.dao.admin.AdminMapper;
|
||||
import com.caliverse.admin.domain.dao.admin.GroupMapper;
|
||||
import com.caliverse.admin.domain.entity.*;
|
||||
import com.caliverse.admin.domain.entity.log.LogAction;
|
||||
import com.caliverse.admin.domain.request.AdminRequest;
|
||||
import com.caliverse.admin.domain.request.AuthenticateRequest;
|
||||
import com.caliverse.admin.domain.response.AdminResponse;
|
||||
import com.caliverse.admin.global.common.annotation.BusinessProcess;
|
||||
import com.caliverse.admin.global.common.code.CommonCode;
|
||||
import com.caliverse.admin.global.common.code.ErrorCode;
|
||||
import com.caliverse.admin.global.common.code.SuccessCode;
|
||||
import com.caliverse.admin.global.common.constants.MysqlConstants;
|
||||
import com.caliverse.admin.global.common.exception.RestApiException;
|
||||
import com.caliverse.admin.global.common.utils.CommonUtils;
|
||||
import com.caliverse.admin.mongodb.service.MysqlHistoryLogService;
|
||||
import jakarta.mail.internet.MimeMessage;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.json.JSONObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
@@ -56,20 +54,16 @@ public class AdminService {
|
||||
@Value("${spring.mail.password}")
|
||||
private String password;
|
||||
// 비번 초기화
|
||||
@BusinessProcess(action = LogAction.PASSWORD_INIT)
|
||||
@Transactional(transactionManager = "transactionManager")
|
||||
public AdminResponse initPassword(AuthenticateRequest authenticateRequest){
|
||||
|
||||
Optional<Admin> admin = adminMapper.findByEmail(authenticateRequest.getEmail());
|
||||
String initPwd = randomPwd();
|
||||
adminMapper.initPwd(passwordEncoder.encode(initPwd), admin.get().getId(), CommonUtils.getAdmin().getId());
|
||||
//유저 비번 기록 남기기
|
||||
adminMapper.saveHistoryPwd(passwordEncoder.encode(initPwd), admin.get().getId());
|
||||
//smtp
|
||||
sendMail(authenticateRequest.getEmail(),initPwd);
|
||||
|
||||
IAdminLog adminLog = new AdminPasswordInitLog(admin.get().getName(), admin.get().getEmail());
|
||||
adminLog.saveLogToDB();
|
||||
|
||||
log.info("initPassword id: {}, email: {}", admin.get().getId(), admin.get().getEmail());
|
||||
|
||||
return AdminResponse.builder()
|
||||
@@ -80,6 +74,7 @@ public class AdminService {
|
||||
}
|
||||
|
||||
// 비번 재설정
|
||||
@BusinessProcess(action = LogAction.PASSWORD_CHANGE)
|
||||
@Transactional(transactionManager = "transactionManager")
|
||||
public AdminResponse updatePassword(AuthenticateRequest authenticateRequest){
|
||||
|
||||
@@ -87,6 +82,8 @@ public class AdminService {
|
||||
String newPwd = authenticateRequest.getNewPassword();
|
||||
String pwdById = adminMapper.findPwdById(CommonUtils.getAdmin().getId());
|
||||
|
||||
Optional<Admin> beforeInfo = adminMapper.findByEmail(CommonUtils.getAdmin().getEmail());
|
||||
|
||||
/*
|
||||
https://nzin-publisher-bts.atlassian.net/browse/CAL-120
|
||||
임시 비밀번호 재설정 화면에서 현재 비밀번호 입력 필드가 노출되는 현상
|
||||
@@ -102,8 +99,6 @@ public class AdminService {
|
||||
|
||||
if(count == 0){
|
||||
adminMapper.updatePwd(passwordEncoder.encode(newPwd), CommonUtils.getAdmin().getId(), STATUS.PERMITTED );
|
||||
//유저 비번 기록 남기기
|
||||
adminMapper.saveHistoryPwd(passwordEncoder.encode(newPwd), CommonUtils.getAdmin().getId());
|
||||
}else{
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.PASSWORD_INCLUDE.getMessage());
|
||||
}
|
||||
@@ -168,6 +163,7 @@ public class AdminService {
|
||||
}
|
||||
|
||||
// 로그인 승인/불가
|
||||
@BusinessProcess(action = LogAction.ADMIN)
|
||||
@Transactional(transactionManager = "transactionManager")
|
||||
public AdminResponse updateStatus(AdminRequest adminRequest){
|
||||
Map<String , Object> map = new HashMap<>();
|
||||
@@ -187,14 +183,6 @@ public class AdminService {
|
||||
}
|
||||
//로그인 승인
|
||||
adminMapper.updateStatus(map);
|
||||
|
||||
mysqlHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPEDETAIL.LOGIN_PERMITTED,
|
||||
MysqlConstants.TABLE_NAME_ADMIN,
|
||||
HISTORYTYPEDETAIL.LOGIN_PERMITTED.name(),
|
||||
info.get(),
|
||||
adminMapper.findByEmail(email)
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
@@ -207,7 +195,8 @@ public class AdminService {
|
||||
.build();
|
||||
}
|
||||
|
||||
//운영자 그룹 저장
|
||||
//운영자 그룹 변경
|
||||
@BusinessProcess(action = LogAction.ADMIN_GROUP)
|
||||
@Transactional(transactionManager = "transactionManager")
|
||||
public AdminResponse updateGroup(AdminRequest adminRequest){
|
||||
Map<String , Object> map = new HashMap<>();
|
||||
@@ -218,19 +207,9 @@ public class AdminService {
|
||||
map.put("group_id", item.getGroupId());
|
||||
map.put("id", CommonUtils.getAdmin().getId());
|
||||
|
||||
//변경전 그룹 명세 조회
|
||||
Optional<Admin> info = adminMapper.findByEmail(email);
|
||||
|
||||
//쿼리 실행
|
||||
adminMapper.updateGroup(map);
|
||||
|
||||
mysqlHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPEDETAIL.ADMIN_INFO_UPDATE,
|
||||
MysqlConstants.TABLE_NAME_ADMIN,
|
||||
HISTORYTYPEDETAIL.ADMIN_INFO_UPDATE.name(),
|
||||
info.get(),
|
||||
adminMapper.findByEmail(email)
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
@@ -243,6 +222,7 @@ public class AdminService {
|
||||
}
|
||||
|
||||
// 운영자 선택 삭제
|
||||
@BusinessProcess(action = LogAction.ADMIN_DELETE)
|
||||
@Transactional(transactionManager = "transactionManager")
|
||||
public AdminResponse deleteAdmin(AdminRequest adminRequest){
|
||||
Map<String , Object> map = new HashMap<>();
|
||||
@@ -250,18 +230,9 @@ public class AdminService {
|
||||
item -> {
|
||||
map.put("email", item.getEmail());
|
||||
map.put("deleted", String.valueOf(1));
|
||||
//로그 기록
|
||||
Optional<Admin> info = adminMapper.findByEmail(item.getEmail());
|
||||
|
||||
//쿼리 실행
|
||||
adminMapper.deleteAdmin(map);
|
||||
|
||||
mysqlHistoryLogService.deleteHistoryLog(
|
||||
HISTORYTYPEDETAIL.ADMIN_INFO_DELETE,
|
||||
MysqlConstants.TABLE_NAME_ADMIN,
|
||||
HISTORYTYPEDETAIL.ADMIN_INFO_DELETE.name(),
|
||||
info.get()
|
||||
);
|
||||
}
|
||||
);
|
||||
log.info("deleteAdmin Deleted Admin: {}", map);
|
||||
|
||||
@@ -5,8 +5,10 @@ import com.caliverse.admin.domain.dao.admin.TokenMapper;
|
||||
import com.caliverse.admin.domain.entity.Admin;
|
||||
import com.caliverse.admin.domain.entity.STATUS;
|
||||
import com.caliverse.admin.domain.entity.Token;
|
||||
import com.caliverse.admin.domain.entity.log.LogAction;
|
||||
import com.caliverse.admin.domain.request.AuthenticateRequest;
|
||||
import com.caliverse.admin.domain.response.AuthenticateResponse;
|
||||
import com.caliverse.admin.global.common.annotation.BusinessProcess;
|
||||
import com.caliverse.admin.global.common.code.CommonCode;
|
||||
import com.caliverse.admin.global.common.code.ErrorCode;
|
||||
import com.caliverse.admin.global.common.code.SuccessCode;
|
||||
@@ -21,6 +23,7 @@ import org.springframework.security.authentication.UsernamePasswordAuthenticatio
|
||||
import org.springframework.security.core.AuthenticationException;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
@@ -32,7 +35,7 @@ import java.time.temporal.ChronoUnit;
|
||||
@RequiredArgsConstructor
|
||||
public class AuthenticateService{
|
||||
|
||||
private final AdminMapper userMapper;
|
||||
private final AdminMapper adminMapper;
|
||||
private final TokenMapper tokenMapper;
|
||||
private final AuthenticationManager authenticationManager;
|
||||
private final JwtService jwtService;
|
||||
@@ -47,7 +50,7 @@ public class AuthenticateService{
|
||||
String email = authenticateRequest.getEmail();
|
||||
String pw = authenticateRequest.getPassword();
|
||||
// 삭제 계정 여부
|
||||
if(!userMapper.existsByEmail(email)){
|
||||
if(!adminMapper.existsByEmail(email)){
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.NOT_MATCH_USER.getMessage());
|
||||
}
|
||||
|
||||
@@ -58,7 +61,7 @@ public class AuthenticateService{
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.NOT_FOUND_USER.getMessage());
|
||||
}
|
||||
|
||||
Admin admin = userMapper.findByEmail(authenticateRequest.getEmail())
|
||||
Admin admin = adminMapper.findByEmail(authenticateRequest.getEmail())
|
||||
.orElseThrow(() -> new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.NOT_MATCH_USER.getMessage()));
|
||||
|
||||
//비번 기간 만료
|
||||
@@ -93,9 +96,11 @@ public class AuthenticateService{
|
||||
}
|
||||
|
||||
//회원가입
|
||||
@BusinessProcess(action = LogAction.USER)
|
||||
@Transactional(transactionManager = "transactionManager")
|
||||
public AuthenticateResponse register(AuthenticateRequest authenticateRequest){
|
||||
|
||||
if(userMapper.existsByEmail(authenticateRequest.getEmail())){
|
||||
if(adminMapper.existsByEmail(authenticateRequest.getEmail())){
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DUPLICATED_EMAIL.getMessage());
|
||||
}
|
||||
|
||||
@@ -108,7 +113,7 @@ public class AuthenticateService{
|
||||
.password(passwordEncoder.encode(authenticateRequest.getPassword()))
|
||||
.build();
|
||||
|
||||
userMapper.save(admin);
|
||||
adminMapper.save(admin);
|
||||
log.info("register Sign Up : {}", admin);
|
||||
return AuthenticateResponse.builder()
|
||||
.status(CommonCode.SUCCESS.getHttpStatus())
|
||||
|
||||
@@ -4,6 +4,8 @@ import com.caliverse.admin.domain.dao.admin.BattleMapper;
|
||||
import com.caliverse.admin.domain.datacomponent.MetaDataHandler;
|
||||
import com.caliverse.admin.domain.entity.BattleEvent;
|
||||
import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
|
||||
import com.caliverse.admin.domain.entity.log.LogAction;
|
||||
import com.caliverse.admin.domain.entity.log.LogStatus;
|
||||
import com.caliverse.admin.domain.entity.metadata.MetaBattleConfigData;
|
||||
import com.caliverse.admin.domain.entity.metadata.MetaBattleRewardData;
|
||||
import com.caliverse.admin.domain.entity.metadata.MetaGameFFAConfigData;
|
||||
@@ -11,6 +13,7 @@ import com.caliverse.admin.domain.entity.metadata.MetaGameModeData;
|
||||
import com.caliverse.admin.domain.request.BattleEventRequest;
|
||||
import com.caliverse.admin.domain.response.BattleEventResponse;
|
||||
import com.caliverse.admin.dynamodb.service.DynamodbBattleEventService;
|
||||
import com.caliverse.admin.global.common.annotation.BusinessProcess;
|
||||
import com.caliverse.admin.global.common.code.CommonCode;
|
||||
import com.caliverse.admin.global.common.code.ErrorCode;
|
||||
import com.caliverse.admin.global.common.code.SuccessCode;
|
||||
@@ -127,6 +130,7 @@ public class BattleEventService {
|
||||
}
|
||||
|
||||
// 전투시스템 이벤트 저장
|
||||
@BusinessProcess(action = LogAction.BATTLE_EVENT)
|
||||
@Transactional(transactionManager = "transactionManager")
|
||||
public BattleEventResponse postBattleEvent(BattleEventRequest battleEventRequest){
|
||||
if(battleEventRequest.getRepeatType().equals(BattleEvent.BATTLE_REPEAT_TYPE.NONE)){
|
||||
@@ -153,7 +157,7 @@ public class BattleEventService {
|
||||
.result(ErrorCode.ERROR_BATTLE_EVENT_TIME_OVER.toString())
|
||||
.build();
|
||||
}
|
||||
|
||||
// metadata기준 되기전에 운영툴에서 입력값받아서 계산하던 부분
|
||||
// int operation_time = ffACalcEndTime(battleEventRequest);
|
||||
|
||||
List<BattleEvent> existingList = battleMapper.getCheckBattleEventList(battleEventRequest);
|
||||
@@ -171,23 +175,11 @@ public class BattleEventService {
|
||||
// battleEventRequest.setEventId(next_event_id);
|
||||
|
||||
int result = battleMapper.postBattleEvent(battleEventRequest);
|
||||
log.info("AdminToolDB BattleEvent Save: {}", battleEventRequest);
|
||||
log.info("AdminToolDB BattleEvent Save id: {}", battleEventRequest.getId());
|
||||
|
||||
long battle_event_id = battleEventRequest.getId();
|
||||
battleEventRequest.setEventId((int) battle_event_id);
|
||||
|
||||
HashMap<String,String> map = new HashMap<>();
|
||||
map.put("id",String.valueOf(battle_event_id));
|
||||
|
||||
BattleEvent event_info = battleMapper.getBattleEventDetail(battle_event_id);
|
||||
|
||||
mysqlHistoryLogService.insertHistoryLog(
|
||||
HISTORYTYPEDETAIL.BATTLE_EVENT_ADD,
|
||||
MysqlConstants.TABLE_NAME_BATTLE_EVENT,
|
||||
HISTORYTYPEDETAIL.BATTLE_EVENT_ADD.name(),
|
||||
event_info
|
||||
);
|
||||
|
||||
dynamodbBattleEventService.insertBattleEvent(battleEventRequest);
|
||||
|
||||
return BattleEventResponse.builder()
|
||||
@@ -200,6 +192,7 @@ public class BattleEventService {
|
||||
}
|
||||
|
||||
// 전투시스템 이벤트 수정
|
||||
@BusinessProcess(action = LogAction.BATTLE_EVENT)
|
||||
@Transactional(transactionManager = "transactionManager")
|
||||
public BattleEventResponse updateBattleEvent(Long id, BattleEventRequest battleEventRequest) {
|
||||
battleEventRequest.setId(id);
|
||||
@@ -237,20 +230,7 @@ public class BattleEventService {
|
||||
battleEventRequest.setEventEndDt(end_dt_kst);
|
||||
|
||||
int result = battleMapper.updateBattleEvent(battleEventRequest);
|
||||
log.info("AdminToolDB BattleEvent Update Complete: {}", battleEventRequest);
|
||||
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("id", String.valueOf(id));
|
||||
|
||||
BattleEvent after_info = battleMapper.getBattleEventDetail(id);
|
||||
|
||||
mysqlHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPEDETAIL.BATTLE_EVENT_UPDATE,
|
||||
MysqlConstants.TABLE_NAME_BATTLE_EVENT,
|
||||
HISTORYTYPEDETAIL.BATTLE_EVENT_UPDATE.name(),
|
||||
before_info,
|
||||
after_info
|
||||
);
|
||||
log.info("AdminToolDB BattleEvent Update Complete id: {}", id);
|
||||
|
||||
dynamodbBattleEventService.updateBattleEvent(battleEventRequest);
|
||||
|
||||
@@ -263,6 +243,7 @@ public class BattleEventService {
|
||||
}
|
||||
|
||||
// 전투시스템 이벤트 중단
|
||||
@BusinessProcess(action = LogAction.BATTLE_EVENT)
|
||||
@Transactional(transactionManager = "transactionManager")
|
||||
public BattleEventResponse updateStopBattleEvent(Long id){
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
@@ -280,19 +261,7 @@ public class BattleEventService {
|
||||
map.put("status", BattleEvent.BATTLE_STATUS.STOP);
|
||||
map.put("updateBy", CommonUtils.getAdmin().getId());
|
||||
int result = battleMapper.updateStatusBattleEvent(map);
|
||||
try{
|
||||
log.info("BattleEvent Stop Complete: {}", objectMapper.writeValueAsString(info));
|
||||
}catch(Exception e){
|
||||
log.error("BattleEvent Stop Failed: {}", e.getMessage());
|
||||
}
|
||||
|
||||
mysqlHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPEDETAIL.BATTLE_EVENT_UPDATE,
|
||||
MysqlConstants.TABLE_NAME_BATTLE_EVENT,
|
||||
HISTORYTYPEDETAIL.BATTLE_EVENT_UPDATE.name(),
|
||||
info,
|
||||
battleMapper.getBattleEventDetail(id)
|
||||
);
|
||||
log.info("BattleEvent Stop Complete id: {}", id);
|
||||
|
||||
dynamodbBattleEventService.updateStopBattleEvent(info);
|
||||
|
||||
@@ -305,6 +274,7 @@ public class BattleEventService {
|
||||
}
|
||||
|
||||
// 전투시스템 이벤트 삭제(사용안함)
|
||||
@BusinessProcess(action = LogAction.BATTLE_EVENT)
|
||||
@Transactional(transactionManager = "transactionManager")
|
||||
public BattleEventResponse deleteBattleEvent(BattleEventRequest battleEventRequest){
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
@@ -325,13 +295,6 @@ public class BattleEventService {
|
||||
int result = battleMapper.deleteBattleEvent(map);
|
||||
log.info("BattleEvent Delete Complete: {}", item);
|
||||
|
||||
mysqlHistoryLogService.deleteHistoryLog(
|
||||
HISTORYTYPEDETAIL.BATTLE_EVENT_DELETE,
|
||||
MysqlConstants.TABLE_NAME_BATTLE_EVENT,
|
||||
HISTORYTYPEDETAIL.BATTLE_EVENT_DELETE.name(),
|
||||
info
|
||||
);
|
||||
|
||||
// dynamodbLandAuctionService.cancelLandAuction(auction_info);
|
||||
}
|
||||
);
|
||||
@@ -355,6 +318,7 @@ public class BattleEventService {
|
||||
return battleMapper.getScheduleBattleEventList();
|
||||
}
|
||||
|
||||
@BusinessProcess(action = LogAction.BATTLE_EVENT)
|
||||
@Transactional(transactionManager = "transactionManager")
|
||||
public void updateBattleEventStatus(Map<String,Object> map){
|
||||
try{
|
||||
|
||||
@@ -4,9 +4,11 @@ import com.caliverse.admin.domain.dao.admin.BlackListMapper;
|
||||
import com.caliverse.admin.domain.entity.BlackList;
|
||||
import com.caliverse.admin.domain.entity.Excel;
|
||||
import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
|
||||
import com.caliverse.admin.domain.entity.log.LogAction;
|
||||
import com.caliverse.admin.domain.request.BlackListRequest;
|
||||
import com.caliverse.admin.domain.response.BlackListResponse;
|
||||
import com.caliverse.admin.dynamodb.service.DynamodbUserService;
|
||||
import com.caliverse.admin.global.common.annotation.BusinessProcess;
|
||||
import com.caliverse.admin.global.common.code.CommonCode;
|
||||
import com.caliverse.admin.global.common.code.ErrorCode;
|
||||
import com.caliverse.admin.global.common.code.SuccessCode;
|
||||
@@ -142,6 +144,7 @@ public class BlackListService {
|
||||
return resourceLoader.getResource(excelPath + fileName);
|
||||
}
|
||||
|
||||
@BusinessProcess(action = LogAction.BLACK_LIST)
|
||||
@Transactional(transactionManager = "transactionManager")
|
||||
public BlackListResponse postBlackList(BlackListRequest blackListRequest){
|
||||
|
||||
@@ -167,16 +170,8 @@ public class BlackListService {
|
||||
blackListRequest.setGuid(guid);
|
||||
blackListRequest.setNickname(item.getNickname());
|
||||
blackListMapper.postBlackList(blackListRequest);
|
||||
logger.info("postBlackList insertBlackList: {}",blackListRequest);
|
||||
logger.info("postBlackList insertBlackList id: {}",blackListRequest.getId());
|
||||
|
||||
BlackList info = blackListMapper.getBlackListDetail(blackListRequest.getId());
|
||||
|
||||
mysqlHistoryLogService.insertHistoryLog(
|
||||
HISTORYTYPEDETAIL.BLACKLIST_ADD,
|
||||
MysqlConstants.TABLE_NAME_USER_BLOCK,
|
||||
HISTORYTYPEDETAIL.BLACKLIST_ADD.name(),
|
||||
info
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -201,16 +196,8 @@ public class BlackListService {
|
||||
blackListRequest.setGuid(item.getGuid());
|
||||
blackListRequest.setNickname(dynamodbUserService.getGuidByName(item.getGuid()));
|
||||
blackListMapper.postBlackList(blackListRequest);
|
||||
logger.info("postBlackList insertBlackList: {}",blackListRequest);
|
||||
logger.info("postBlackList insertBlackList id: {}",blackListRequest.getId());
|
||||
|
||||
BlackList info = blackListMapper.getBlackListDetail(blackListRequest.getId());
|
||||
|
||||
mysqlHistoryLogService.insertHistoryLog(
|
||||
HISTORYTYPEDETAIL.BLACKLIST_ADD,
|
||||
MysqlConstants.TABLE_NAME_USER_BLOCK,
|
||||
HISTORYTYPEDETAIL.BLACKLIST_ADD.name(),
|
||||
info
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -225,6 +212,7 @@ public class BlackListService {
|
||||
|
||||
}
|
||||
|
||||
@BusinessProcess(action = LogAction.BLACK_LIST)
|
||||
@Transactional(transactionManager = "transactionManager")
|
||||
public BlackListResponse deleteBlackList(BlackListRequest blackListRequest){
|
||||
|
||||
@@ -238,15 +226,7 @@ public class BlackListService {
|
||||
map.put("reason",item.getReason());
|
||||
blackListMapper.deleteBlackList(map);
|
||||
|
||||
logger.info("deleteBlackList delete: {}",map);
|
||||
|
||||
mysqlHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPEDETAIL.BLACKLIST_DELETE,
|
||||
MysqlConstants.TABLE_NAME_USER_BLOCK,
|
||||
HISTORYTYPEDETAIL.BLACKLIST_DELETE.name(),
|
||||
blackList,
|
||||
blackListMapper.getBlackListDetail(id)
|
||||
);
|
||||
logger.info("deleteBlackList delete id: {}", id);
|
||||
|
||||
if(dynamodbUserService.isBlockUser(blackList.getGuid()))
|
||||
dynamodbUserService.updateBlockUser(BlackList.STATUSTYPE.EXPIRATION, blackList);
|
||||
@@ -261,6 +241,7 @@ public class BlackListService {
|
||||
.build();
|
||||
}
|
||||
|
||||
@BusinessProcess(action = LogAction.BLACK_LIST)
|
||||
@Transactional(transactionManager = "transactionManager")
|
||||
public void updateBlackListStatus(Long id, BlackList.STATUSTYPE status){
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
@@ -269,7 +250,7 @@ public class BlackListService {
|
||||
|
||||
blackListMapper.updateStatus(map);
|
||||
|
||||
logger.info("updateBlackListStatus BlackListSchedule status update: {}",map);
|
||||
logger.info("updateBlackListStatus status update id: {}, status: {}", id, status.toString());
|
||||
}
|
||||
|
||||
public List<BlackList> getScheduleBlackList(){
|
||||
|
||||
@@ -13,19 +13,16 @@ import com.caliverse.admin.domain.request.Web3Request;
|
||||
import com.caliverse.admin.domain.response.CaliumResponse;
|
||||
import com.caliverse.admin.domain.response.Web3Response;
|
||||
import com.caliverse.admin.dynamodb.service.DynamodbCaliumService;
|
||||
import com.caliverse.admin.global.common.annotation.BusinessProcess;
|
||||
import com.caliverse.admin.global.common.code.CommonCode;
|
||||
import com.caliverse.admin.global.common.code.ErrorCode;
|
||||
import com.caliverse.admin.global.common.code.SuccessCode;
|
||||
import com.caliverse.admin.global.common.constants.MysqlConstants;
|
||||
import com.caliverse.admin.global.common.constants.Web3Constants;
|
||||
import com.caliverse.admin.global.common.utils.CommonUtils;
|
||||
import com.caliverse.admin.logs.Indicatordomain.GenericMongoLog;
|
||||
import com.caliverse.admin.logs.entity.LogAction;
|
||||
import com.caliverse.admin.logs.logservice.businesslogservice.BusinessLogGenericService;
|
||||
import com.caliverse.admin.mongodb.service.MysqlHistoryLogService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.json.JSONObject;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -42,11 +39,8 @@ import java.util.Optional;
|
||||
public class CaliumService {
|
||||
|
||||
private final CaliumMapper caliumMapper;
|
||||
private final HistoryService historyService;
|
||||
private final Web3Service web3Service;
|
||||
// private final DynamoDBService dynamoDBService;
|
||||
private final DynamodbCaliumService dynamodbCaliumService;
|
||||
private final MysqlHistoryLogService mysqlHistoryLogService;
|
||||
private final BusinessLogGenericService businessLogGenericService;
|
||||
|
||||
public CaliumResponse getCaliumLimit(){
|
||||
@@ -125,6 +119,7 @@ public class CaliumService {
|
||||
.build();
|
||||
}
|
||||
|
||||
@BusinessProcess(action = com.caliverse.admin.domain.entity.log.LogAction.CALIUM_REQUEST)
|
||||
@Transactional(transactionManager = "transactionManager")
|
||||
public CaliumResponse postCaliumRequest(CaliumRequest caliumRequest){
|
||||
caliumRequest.setCreateBy(CommonUtils.getAdmin().getId());
|
||||
@@ -159,15 +154,6 @@ public class CaliumService {
|
||||
int result = caliumMapper.postCaliumRequest(caliumRequest);
|
||||
log.info("postEvent AdminToolDB Event Save: {}", caliumRequest);
|
||||
|
||||
Calium calium = caliumMapper.getCaliumRequestDetail(caliumRequest.getId());
|
||||
|
||||
mysqlHistoryLogService.insertHistoryLog(
|
||||
HISTORYTYPEDETAIL.CALIUM_ADD,
|
||||
MysqlConstants.TABLE_NAME_CALIUM_REQUEST,
|
||||
HISTORYTYPEDETAIL.CALIUM_ADD.name(),
|
||||
calium
|
||||
);
|
||||
|
||||
return CaliumResponse.builder()
|
||||
.status(CommonCode.SUCCESS.getHttpStatus())
|
||||
.result(CommonCode.SUCCESS.getResult())
|
||||
@@ -177,6 +163,7 @@ public class CaliumService {
|
||||
.build();
|
||||
}
|
||||
|
||||
@BusinessProcess(action = com.caliverse.admin.domain.entity.log.LogAction.CALIUM_REQUEST)
|
||||
@Transactional(transactionManager = "transactionManager")
|
||||
public CaliumResponse updateCaliumCharged(CaliumRequest caliumRequest){
|
||||
log.info("updateCaliumCharged calium Request: {}", caliumRequest);
|
||||
@@ -200,25 +187,13 @@ public class CaliumService {
|
||||
|
||||
updateCaliumRequest(caliumRequest.getId(), Calium.CALIUMREQUESTSTATUS.FINISH);
|
||||
|
||||
mysqlHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPEDETAIL.CALIUM_TOTAL_UPDATE,
|
||||
MysqlConstants.TABLE_NAME_CALIUM_REQUEST,
|
||||
HISTORYTYPEDETAIL.CALIUM_TOTAL_UPDATE.name(),
|
||||
info,
|
||||
caliumMapper.getCaliumRequestDetail(caliumRequest.getId())
|
||||
);
|
||||
|
||||
// JSONObject jsonObject = new JSONObject();
|
||||
// jsonObject.put("dynamoDB_update",dynamoResult);
|
||||
|
||||
// historyService.setLog(HISTORYTYPEDETAIL.CALIUM_TOTAL_UPDATE, jsonObject);
|
||||
|
||||
return CaliumResponse.builder()
|
||||
.status(CommonCode.SUCCESS.getHttpStatus())
|
||||
.result(CommonCode.SUCCESS.getResult())
|
||||
.build();
|
||||
}
|
||||
|
||||
@BusinessProcess(action = com.caliverse.admin.domain.entity.log.LogAction.CALIUM_REQUEST)
|
||||
@Transactional(transactionManager = "transactionManager")
|
||||
public void getScheduleCaliumRequestList(){
|
||||
List<Calium> scheduleList = caliumMapper.getScheduleCaliumRequest();
|
||||
|
||||
@@ -3,10 +3,12 @@ package com.caliverse.admin.domain.service;
|
||||
import com.caliverse.admin.domain.dao.admin.DataMapper;
|
||||
import com.caliverse.admin.domain.dao.admin.LandMapper;
|
||||
import com.caliverse.admin.domain.entity.*;
|
||||
import com.caliverse.admin.domain.entity.log.LogAction;
|
||||
import com.caliverse.admin.domain.request.DataRequest;
|
||||
import com.caliverse.admin.domain.request.LogGenericRequest;
|
||||
import com.caliverse.admin.domain.response.DataResponse;
|
||||
import com.caliverse.admin.dynamodb.service.DynamodbDataService;
|
||||
import com.caliverse.admin.global.common.annotation.BusinessProcess;
|
||||
import com.caliverse.admin.global.common.code.CommonCode;
|
||||
import com.caliverse.admin.global.common.code.ErrorCode;
|
||||
import com.caliverse.admin.global.common.code.SuccessCode;
|
||||
@@ -33,7 +35,6 @@ import java.util.Map;
|
||||
public class DataService {
|
||||
|
||||
private final DynamodbDataService dynamodbDataService;
|
||||
private final MysqlHistoryLogService mysqlHistoryLogService;
|
||||
private final LandMapper landMapper;
|
||||
private final DataMapper dataMapper;
|
||||
private final DataInitializeHistoryService dataInitializeHistoryService;
|
||||
@@ -78,6 +79,7 @@ public class DataService {
|
||||
|
||||
}
|
||||
|
||||
@BusinessProcess(action = LogAction.DATA)
|
||||
@Transactional(transactionManager = "transactionManager")
|
||||
public DataResponse initData(DataRequest dataRequest){
|
||||
EInitDataType dataType = dataRequest.getInitDataType();
|
||||
@@ -86,13 +88,6 @@ public class DataService {
|
||||
|
||||
dataMapper.postDataInit(dataRequest);
|
||||
|
||||
mysqlHistoryLogService.insertHistoryLog(
|
||||
HISTORYTYPEDETAIL.DATA_INIT_ADD,
|
||||
MysqlConstants.TABLE_NAME_DATA_INIT,
|
||||
HISTORYTYPEDETAIL.DATA_INIT_ADD.name(),
|
||||
dataMapper.getDataInitDetail(dataRequest.getId())
|
||||
);
|
||||
|
||||
// switch(dataType){
|
||||
// case LandAuction -> {
|
||||
// int result = initLandAuction();
|
||||
@@ -131,26 +126,6 @@ public class DataService {
|
||||
long auctionId = landAuction.getId();
|
||||
int result = landMapper.initLandAuction(auctionId);
|
||||
|
||||
List<Message> message = landMapper.getMessage(auctionId);
|
||||
Map map = new HashMap();
|
||||
map.put("id", landAuction.getId());
|
||||
landMapper.deleteMessage(map);
|
||||
|
||||
mysqlHistoryLogService.deleteHistoryLog(
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_INITIALIZE,
|
||||
MysqlConstants.TABLE_NAME_LAND_AUCTION,
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_INITIALIZE.name(),
|
||||
landAuction
|
||||
);
|
||||
if (!message.isEmpty()) {
|
||||
mysqlHistoryLogService.deleteHistoryLog(
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_INITIALIZE,
|
||||
MysqlConstants.TABLE_NAME_MESSAGE,
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_INITIALIZE.name(),
|
||||
message
|
||||
);
|
||||
}
|
||||
|
||||
dataInitializeHistoryService.mysqlDataInitHistory(
|
||||
EInitDataType.LandAuction,
|
||||
MysqlConstants.TABLE_NAME_LAND_AUCTION,
|
||||
@@ -176,13 +151,6 @@ public class DataService {
|
||||
long id = landOwnerChange.getId();
|
||||
landMapper.initLandOwnedChanges(id);
|
||||
|
||||
mysqlHistoryLogService.deleteHistoryLog(
|
||||
HISTORYTYPEDETAIL.LAND_OWNED_INITIALIZE,
|
||||
MysqlConstants.TABLE_NAME_LAND_OWNER_CHANGE,
|
||||
HISTORYTYPEDETAIL.LAND_OWNED_INITIALIZE.name(),
|
||||
landOwnerChange
|
||||
);
|
||||
|
||||
dataInitializeHistoryService.mysqlDataInitHistory(
|
||||
EInitDataType.LandOwned,
|
||||
MysqlConstants.TABLE_NAME_LAND_OWNER_CHANGE,
|
||||
@@ -206,6 +174,7 @@ public class DataService {
|
||||
return dataMapper.getDataInit();
|
||||
}
|
||||
|
||||
@BusinessProcess(action = LogAction.DATA)
|
||||
public void updateStatus(long id, DataInit.DATA_INIT_STATUS status){
|
||||
dataMapper.updateStatus(id, status.toString());
|
||||
}
|
||||
|
||||
@@ -3,21 +3,27 @@ package com.caliverse.admin.domain.service;
|
||||
import com.caliverse.admin.domain.dao.admin.EventMapper;
|
||||
import com.caliverse.admin.domain.datacomponent.MetaDataHandler;
|
||||
import com.caliverse.admin.domain.entity.*;
|
||||
import com.caliverse.admin.domain.entity.log.LogAction;
|
||||
import com.caliverse.admin.domain.entity.log.LogStatus;
|
||||
import com.caliverse.admin.domain.request.EventRequest;
|
||||
import com.caliverse.admin.domain.response.EventResponse;
|
||||
import com.caliverse.admin.dynamodb.service.DynamodbMailService;
|
||||
import com.caliverse.admin.dynamodb.service.DynamodbService;
|
||||
import com.caliverse.admin.global.common.annotation.BusinessProcess;
|
||||
import com.caliverse.admin.global.common.code.CommonCode;
|
||||
import com.caliverse.admin.global.common.code.ErrorCode;
|
||||
import com.caliverse.admin.global.common.code.SuccessCode;
|
||||
import com.caliverse.admin.global.common.constants.MysqlConstants;
|
||||
import com.caliverse.admin.global.common.utils.CommonUtils;
|
||||
import com.caliverse.admin.global.component.manager.BusinessProcessIdManager;
|
||||
import com.caliverse.admin.mongodb.service.MysqlHistoryLogService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.json.JSONObject;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.support.TransactionSynchronization;
|
||||
import org.springframework.transaction.support.TransactionSynchronizationManager;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.HashMap;
|
||||
@@ -33,8 +39,8 @@ public class EventService {
|
||||
|
||||
private final EventMapper eventMapper;
|
||||
private final MetaDataHandler metaDataHandler;
|
||||
private final HistoryService historyService;
|
||||
private final MysqlHistoryLogService mysqlHistoryLogService;
|
||||
private final BusinessProcessIdManager processIdManager;
|
||||
|
||||
public EventResponse getList(Map requestParam){
|
||||
//페이징 처리
|
||||
@@ -80,6 +86,7 @@ public class EventService {
|
||||
.build();
|
||||
}
|
||||
|
||||
@BusinessProcess(action = LogAction.EVENT)
|
||||
@Transactional(transactionManager = "transactionManager")
|
||||
public EventResponse postEvent(EventRequest eventRequest){
|
||||
eventRequest.setCreateBy(CommonUtils.getAdmin().getId());
|
||||
@@ -117,14 +124,29 @@ public class EventService {
|
||||
}
|
||||
log.info("postEvent AdminToolDB Message Save Complete");
|
||||
|
||||
Event event = eventMapper.getEventDetail(event_id);
|
||||
String prodId = processIdManager.getCurrentProcessId();
|
||||
|
||||
Event event = eventMapper.getEventDetail(event_id);
|
||||
event.setMailList(eventMapper.getMessage(event_id));
|
||||
event.setItemList(eventMapper.getItem(event_id));
|
||||
|
||||
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
|
||||
@Override
|
||||
public void afterCommit() {
|
||||
try {
|
||||
mysqlHistoryLogService.insertHistoryLog(
|
||||
HISTORYTYPEDETAIL.EVENT_ADD,
|
||||
prodId,
|
||||
LogAction.EVENT,
|
||||
LogStatus.SUCCESS,
|
||||
MysqlConstants.TABLE_NAME_EVENT,
|
||||
HISTORYTYPEDETAIL.EVENT_ADD.name(),
|
||||
"",
|
||||
event
|
||||
);
|
||||
} catch (Exception e) {
|
||||
log.warn("Failed to log event creation: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return EventResponse.builder()
|
||||
.status(CommonCode.SUCCESS.getHttpStatus())
|
||||
@@ -135,6 +157,7 @@ public class EventService {
|
||||
.build();
|
||||
}
|
||||
|
||||
@BusinessProcess(action = LogAction.EVENT)
|
||||
@Transactional(transactionManager = "transactionManager")
|
||||
public EventResponse updateEvent(Long id, EventRequest eventRequest) {
|
||||
eventRequest.setId(id);
|
||||
@@ -147,7 +170,7 @@ public class EventService {
|
||||
before_info.setItemList(eventMapper.getItem(event_id));
|
||||
|
||||
int result = eventMapper.updateEvent(eventRequest);
|
||||
log.info("updateEvent AdminToolDB Event Update Complete: {}", eventRequest);
|
||||
|
||||
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("mailId", String.valueOf(event_id));
|
||||
@@ -164,7 +187,6 @@ public class EventService {
|
||||
eventMapper.insertItem(map);
|
||||
});
|
||||
}
|
||||
log.info("updateEvent AdminToolDB Item Update Complete");
|
||||
|
||||
// message 테이블 데이터 삭제 처리 by mail_id
|
||||
eventMapper.deleteMessage(map);
|
||||
@@ -179,19 +201,31 @@ public class EventService {
|
||||
eventMapper.insertMessage(map);
|
||||
});
|
||||
}
|
||||
log.info("updateEvent AdminToolDB Message Update Complete");
|
||||
log.info("updateEvent AdminToolDB Event Update Complete id: {}", eventRequest.getId());
|
||||
|
||||
Event after_event = eventMapper.getEventDetail(event_id);
|
||||
after_event.setMailList(eventMapper.getMessage(event_id));
|
||||
after_event.setItemList(eventMapper.getItem(event_id));
|
||||
|
||||
String prodId = processIdManager.getCurrentProcessId();
|
||||
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
|
||||
@Override
|
||||
public void afterCommit() {
|
||||
try {
|
||||
mysqlHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPEDETAIL.EVENT_UPDATE,
|
||||
prodId,
|
||||
LogAction.EVENT,
|
||||
LogStatus.SUCCESS,
|
||||
MysqlConstants.TABLE_NAME_EVENT,
|
||||
HISTORYTYPEDETAIL.EVENT_UPDATE.name(),
|
||||
"",
|
||||
before_info,
|
||||
after_event
|
||||
);
|
||||
} catch (Exception e) {
|
||||
log.warn("Failed to log event creation: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return EventResponse.builder()
|
||||
.status(CommonCode.SUCCESS.getHttpStatus())
|
||||
@@ -202,6 +236,7 @@ public class EventService {
|
||||
.build();
|
||||
}
|
||||
|
||||
@BusinessProcess(action = LogAction.EVENT)
|
||||
@Transactional(transactionManager = "transactionManager")
|
||||
public EventResponse deleteEvent(EventRequest eventRequest){
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
@@ -213,17 +248,10 @@ public class EventService {
|
||||
event.setMailList(eventMapper.getMessage(event_id));
|
||||
event.setItemList(eventMapper.getItem(event_id));
|
||||
|
||||
map.put("mailId",event_id);
|
||||
map.put("id",event_id);
|
||||
map.put("desc", item.getDeleteDesc());
|
||||
int result = eventMapper.deleteEvent(map);
|
||||
log.info("updateEvent AdminTool Delete Complete: {}", eventRequest);
|
||||
|
||||
mysqlHistoryLogService.deleteHistoryLog(
|
||||
HISTORYTYPEDETAIL.EVENT_DELETE,
|
||||
MysqlConstants.TABLE_NAME_EVENT,
|
||||
HISTORYTYPEDETAIL.EVENT_DELETE.name(),
|
||||
event
|
||||
);
|
||||
log.info("updateEvent AdminTool Delete Complete id: {}", event_id);
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
package com.caliverse.admin.domain.service;
|
||||
|
||||
import com.caliverse.admin.domain.datacomponent.MetaDataHandler;
|
||||
import com.caliverse.admin.domain.entity.BattleEvent;
|
||||
import com.caliverse.admin.domain.entity.metadata.*;
|
||||
import com.caliverse.admin.domain.request.BattleEventRequest;
|
||||
import com.caliverse.admin.domain.response.BattleEventResponse;
|
||||
import com.caliverse.admin.dynamodb.service.DynamodbBattleEventService;
|
||||
import com.caliverse.admin.global.common.code.CommonCode;
|
||||
import com.caliverse.admin.global.common.utils.CommonUtils;
|
||||
import com.caliverse.admin.mongodb.service.MysqlHistoryLogService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class GameSettingService {
|
||||
|
||||
private final DynamodbBattleEventService dynamodbBattleEventService;
|
||||
|
||||
private final MetaDataHandler metaDataHandler;
|
||||
private final MysqlHistoryLogService mysqlHistoryLogService;
|
||||
|
||||
// 게임 셋팅 설정 조회
|
||||
public BattleEventResponse getGameSettingList(@RequestParam Map<String, String> requestParam){
|
||||
|
||||
requestParam = CommonUtils.pageSetting(requestParam);
|
||||
|
||||
List<MetaGameModeMatchData> list = metaDataHandler.getMetaGameModeMatchListData();
|
||||
|
||||
return BattleEventResponse.builder()
|
||||
.status(CommonCode.SUCCESS.getHttpStatus())
|
||||
.result(CommonCode.SUCCESS.getResult())
|
||||
.resultData(BattleEventResponse.ResultData.builder()
|
||||
// .battleEventList(list)
|
||||
.pageNo(requestParam.get("page_no")!=null?
|
||||
Integer.parseInt(requestParam.get("page_no")):1)
|
||||
.build()
|
||||
)
|
||||
.build();
|
||||
}
|
||||
|
||||
// 게임 셋팅 설정 상세조회
|
||||
public BattleEventResponse getGameSettingDetail(Long id){
|
||||
|
||||
BattleEvent battleEvent = null;
|
||||
|
||||
return BattleEventResponse.builder()
|
||||
.status(CommonCode.SUCCESS.getHttpStatus())
|
||||
.result(CommonCode.SUCCESS.getResult())
|
||||
.resultData(BattleEventResponse.ResultData.builder()
|
||||
.battleEvent(battleEvent)
|
||||
.build())
|
||||
.build();
|
||||
}
|
||||
|
||||
// 게임 셋팅 설정 저장/수정
|
||||
@Transactional(transactionManager = "transactionManager")
|
||||
public BattleEventResponse updateGameSetting(Long id, BattleEventRequest battleEventRequest) {
|
||||
battleEventRequest.setId(id);
|
||||
battleEventRequest.setUpdateBy(CommonUtils.getAdmin().getId());
|
||||
battleEventRequest.setUpdateDt(LocalDateTime.now());
|
||||
|
||||
dynamodbBattleEventService.updateBattleEvent(battleEventRequest);
|
||||
|
||||
return BattleEventResponse.builder()
|
||||
.resultData(BattleEventResponse.ResultData.builder()
|
||||
.build())
|
||||
.status(CommonCode.SUCCESS.getHttpStatus())
|
||||
.result(CommonCode.SUCCESS.getResult())
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,10 +1,11 @@
|
||||
package com.caliverse.admin.domain.service;
|
||||
|
||||
import com.caliverse.admin.domain.dao.admin.GroupMapper;
|
||||
import com.caliverse.admin.domain.dao.admin.HistoryMapper;
|
||||
import com.caliverse.admin.domain.entity.*;
|
||||
import com.caliverse.admin.domain.entity.log.LogAction;
|
||||
import com.caliverse.admin.domain.request.GroupRequest;
|
||||
import com.caliverse.admin.domain.response.GroupResponse;
|
||||
import com.caliverse.admin.global.common.annotation.BusinessProcess;
|
||||
import com.caliverse.admin.global.common.code.CommonCode;
|
||||
import com.caliverse.admin.global.common.code.ErrorCode;
|
||||
import com.caliverse.admin.global.common.code.SuccessCode;
|
||||
@@ -12,7 +13,6 @@ import com.caliverse.admin.global.common.exception.RestApiException;
|
||||
import com.caliverse.admin.global.common.utils.CommonUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.json.JSONObject;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@@ -24,7 +24,6 @@ import java.util.*;
|
||||
public class GroupService {
|
||||
|
||||
private final GroupMapper groupMapper;
|
||||
private final HistoryMapper historyMapper;
|
||||
|
||||
|
||||
// 관리자 권한 리스트 조회
|
||||
@@ -84,6 +83,8 @@ public class GroupService {
|
||||
}
|
||||
|
||||
//권한 그룹 등록
|
||||
@BusinessProcess(action = LogAction.GROUP)
|
||||
@Transactional(transactionManager = "transactionManager")
|
||||
public GroupResponse postAdminGroup(GroupRequest groupRequest){
|
||||
List<Integer> authList = Arrays.asList(1, 5, 6, 9, 10, 11, 13, 14, 15, 16, 19, 22, 24, 26, 32, 36, 41,46, 49); //그룹 초기 권한
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
@@ -92,7 +93,7 @@ public class GroupService {
|
||||
int groupName = groupMapper.findGroupName(groupRequest.getGroupNm());
|
||||
|
||||
if(groupName == 0){
|
||||
groupMapper.postAdminGroup(groupRequest);
|
||||
groupMapper.postGroup(groupRequest);
|
||||
|
||||
map.put("groupId", groupRequest.getId());
|
||||
authList.forEach(val->{
|
||||
@@ -112,6 +113,7 @@ public class GroupService {
|
||||
.build();
|
||||
}
|
||||
//그룹 권한 수정
|
||||
@BusinessProcess(action = LogAction.GROUP)
|
||||
@Transactional(transactionManager = "transactionManager")
|
||||
public GroupResponse updateAdminGroup(String groupId,GroupRequest groupRequest){
|
||||
|
||||
@@ -132,18 +134,7 @@ public class GroupService {
|
||||
);
|
||||
//로그 남기 before 그룹 설정
|
||||
List<Authority> afterAuth = groupMapper.getGroupAuth(Long.valueOf(groupId));
|
||||
log.info("updateAdminGroup after::{}",afterAuth);
|
||||
//로그 기록
|
||||
map.put("adminId", CommonUtils.getAdmin().getId());
|
||||
map.put("name", CommonUtils.getAdmin().getName());
|
||||
map.put("mail", CommonUtils.getAdmin().getEmail());
|
||||
map.put("type", HISTORYTYPEDETAIL.GROUP_AUTH_UPDATE);
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("groupNm",groupMapper.getGroupInfo(Long.valueOf(groupId)).get("name"));
|
||||
jsonObject.put("auth(before)",beforeAuth);
|
||||
jsonObject.put("auth(after)",afterAuth);
|
||||
map.put("content",jsonObject.toString());
|
||||
historyMapper.saveLog(map);
|
||||
log.info("updateAdminGroup groupId: {}", groupId);
|
||||
|
||||
return GroupResponse.builder()
|
||||
.status(CommonCode.SUCCESS.getHttpStatus())
|
||||
@@ -152,25 +143,16 @@ public class GroupService {
|
||||
.build();
|
||||
}
|
||||
//그룹 삭제
|
||||
@BusinessProcess(action = LogAction.GROUP)
|
||||
@Transactional(transactionManager = "transactionManager")
|
||||
public GroupResponse deleteAdminGroup(GroupRequest groupRequest){
|
||||
Map<String, Object> map = new HashMap();
|
||||
groupRequest.getGroupList().forEach(
|
||||
item-> {
|
||||
//순서 바뀜 안됨, 삭제 하기전 그룹명 가져오기
|
||||
Map<String, String> groupInfo = groupMapper.getGroupInfo(item.getGroupId());
|
||||
|
||||
groupMapper.deleteGroup(item.getGroupId());
|
||||
//로그 기록
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("groupNm",groupInfo.get("name"));
|
||||
|
||||
map.put("adminId", CommonUtils.getAdmin().getId());
|
||||
map.put("name", CommonUtils.getAdmin().getName());
|
||||
map.put("mail", CommonUtils.getAdmin().getEmail());
|
||||
map.put("type", HISTORYTYPEDETAIL.GROUP_DELETE);
|
||||
map.put("content",jsonObject.toString());
|
||||
historyMapper.saveLog(map);
|
||||
}
|
||||
);
|
||||
log.info("deleteAdminGroup group: {}", map);
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.caliverse.admin.domain.service;
|
||||
import com.caliverse.admin.domain.dao.admin.AdminMapper;
|
||||
import com.caliverse.admin.domain.entity.Admin;
|
||||
import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
|
||||
import com.caliverse.admin.domain.dao.admin.HistoryMapper;
|
||||
import com.caliverse.admin.domain.request.HistoryRequest;
|
||||
import com.caliverse.admin.domain.response.HistoryResponse;
|
||||
import com.caliverse.admin.global.common.code.CommonCode;
|
||||
@@ -16,16 +15,9 @@ import com.caliverse.admin.mongodb.service.HistoryLogService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
@@ -36,7 +28,6 @@ import java.util.Optional;
|
||||
public class HistoryService {
|
||||
|
||||
private final AdminMapper adminMapper;
|
||||
private final HistoryMapper historyMapper;
|
||||
private final HistoryLogService historyLogService;
|
||||
|
||||
public HistoryResponse getHistoryList(Map requestParams){
|
||||
@@ -74,8 +65,6 @@ public class HistoryService {
|
||||
|
||||
List<HistoryLogInfoBase> historyList = historyLogService.loadHistoryData(historyRequest, HistoryLogInfoBase.class);
|
||||
|
||||
int allCnt = historyMapper.getAllCnt(requestParams);
|
||||
|
||||
return HistoryResponse.builder()
|
||||
.resultData(HistoryResponse.ResultData.builder()
|
||||
.list(historyList)
|
||||
@@ -99,24 +88,11 @@ public class HistoryService {
|
||||
}
|
||||
|
||||
public HistoryResponse getHistoryDetail(String id){
|
||||
String logJson = historyMapper.getLogJson(id);
|
||||
return HistoryResponse.builder()
|
||||
.resultData(HistoryResponse.ResultData.builder().content(logJson).build())
|
||||
.resultData(HistoryResponse.ResultData.builder().build())
|
||||
.status(CommonCode.SUCCESS.getHttpStatus())
|
||||
.result(CommonCode.SUCCESS.getResult())
|
||||
.build();
|
||||
}
|
||||
|
||||
public void setScheduleLog(HISTORYTYPEDETAIL type, String message){
|
||||
//스케줄 로그 기록
|
||||
Map<String, Object> logMap = new HashMap<>();
|
||||
logMap.put("adminId", 1);
|
||||
logMap.put("name", "schedule");
|
||||
logMap.put("mail", "schedule");
|
||||
logMap.put("type", type);
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("message",message);
|
||||
logMap.put("content",jsonObject.toString());
|
||||
historyMapper.saveLog(logMap);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.caliverse.admin.domain.service;
|
||||
import com.caliverse.admin.domain.datacomponent.MetaDataHandler;
|
||||
import com.caliverse.admin.domain.entity.ITEMLARGETYPE;
|
||||
import com.caliverse.admin.domain.entity.SEARCHTYPE;
|
||||
import com.caliverse.admin.domain.entity.log.LogAction;
|
||||
import com.caliverse.admin.domain.response.ItemDeleteResponse;
|
||||
import com.caliverse.admin.domain.response.UsersResponse;
|
||||
import com.caliverse.admin.dynamodb.domain.atrrib.ItemAttrib;
|
||||
@@ -10,6 +11,7 @@ import com.caliverse.admin.dynamodb.domain.doc.ItemDoc;
|
||||
import com.caliverse.admin.dynamodb.dto.PageResult;
|
||||
import com.caliverse.admin.dynamodb.service.DynamodbItemService;
|
||||
import com.caliverse.admin.dynamodb.service.DynamodbUserService;
|
||||
import com.caliverse.admin.global.common.annotation.BusinessProcess;
|
||||
import com.caliverse.admin.global.common.code.ErrorCode;
|
||||
import com.caliverse.admin.global.common.utils.CommonUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -98,7 +100,7 @@ public class ItemsService {
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
@BusinessProcess(action = LogAction.ITEM)
|
||||
@Transactional(transactionManager = "transactionManager")
|
||||
public ItemDeleteResponse postItemDelete(ItemsRequest itemDeleteRequest){
|
||||
String userGuid = itemDeleteRequest.getUserGuid();
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.caliverse.admin.domain.service;
|
||||
import com.caliverse.admin.domain.dao.admin.LandMapper;
|
||||
import com.caliverse.admin.domain.datacomponent.MetaDataHandler;
|
||||
import com.caliverse.admin.domain.entity.*;
|
||||
import com.caliverse.admin.domain.entity.log.LogAction;
|
||||
import com.caliverse.admin.dynamodb.domain.atrrib.LandAttrib;
|
||||
import com.caliverse.admin.dynamodb.domain.atrrib.LandAuctionHighestBidUserAttrib;
|
||||
import com.caliverse.admin.dynamodb.domain.atrrib.LandAuctionRegistryAttrib;
|
||||
@@ -16,6 +17,7 @@ import com.caliverse.admin.dynamodb.service.DynamodbLandAuctionService;
|
||||
import com.caliverse.admin.dynamodb.service.DynamodbLandService;
|
||||
import com.caliverse.admin.dynamodb.service.DynamodbService;
|
||||
import com.caliverse.admin.dynamodb.service.DynamodbUserService;
|
||||
import com.caliverse.admin.global.common.annotation.BusinessProcess;
|
||||
import com.caliverse.admin.global.common.code.CommonCode;
|
||||
import com.caliverse.admin.global.common.code.ErrorCode;
|
||||
import com.caliverse.admin.global.common.code.SuccessCode;
|
||||
@@ -45,17 +47,14 @@ import static com.caliverse.admin.global.common.utils.DateUtils.stringISOToLocal
|
||||
@Slf4j
|
||||
public class LandService {
|
||||
|
||||
// private final DynamoDBService dynamoDBService;
|
||||
private final DynamodbLandAuctionService dynamodbLandAuctionService;
|
||||
private final DynamodbLandService dynamodbLandService;
|
||||
private final DynamodbUserService dynamodbUserService;
|
||||
|
||||
private final LandMapper landMapper;
|
||||
private final MetaDataHandler metaDataHandler;
|
||||
private final HistoryService historyService;
|
||||
private final ObjectMapper objectMapper;
|
||||
private final MysqlHistoryLogService mysqlHistoryLogService;
|
||||
private final DynamodbService dynamodbService;
|
||||
|
||||
public LandResponse getLandInfo(@RequestParam Map<String, String> requestParam){
|
||||
String searchType = requestParam.getOrDefault("land_type", "ID");
|
||||
@@ -314,8 +313,6 @@ public class LandService {
|
||||
|
||||
LandAuction event = landMapper.getLandAuctionDetail(id);
|
||||
|
||||
event.setMessageList(landMapper.getMessage(id));
|
||||
|
||||
log.info("call User Email: {}, event_id: {}", CommonUtils.getAdmin().getEmail(), id);
|
||||
|
||||
return LandResponse.builder()
|
||||
@@ -355,8 +352,6 @@ public class LandService {
|
||||
|
||||
LandAuction landAuction = landMapper.getLandAuctionDetail(id);
|
||||
|
||||
landAuction.setMessageList(landMapper.getMessage(id));
|
||||
|
||||
log.info("call User Email: {}, id: {}", CommonUtils.getAdmin().getEmail(), id);
|
||||
|
||||
return LandResponse.builder()
|
||||
@@ -368,6 +363,7 @@ public class LandService {
|
||||
.build();
|
||||
}
|
||||
|
||||
@BusinessProcess(action = LogAction.LAND_AUCTION)
|
||||
@Transactional(transactionManager = "transactionManager")
|
||||
public LandResponse postLandAuction(LandRequest landRequest){
|
||||
|
||||
@@ -393,35 +389,7 @@ public class LandService {
|
||||
landRequest.setCreateBy(CommonUtils.getAdmin().getId());
|
||||
|
||||
int result = landMapper.postLandAuction(landRequest);
|
||||
log.info("AdminToolDB LandAuction Save: {}", landRequest);
|
||||
|
||||
long auction_id = landRequest.getId();
|
||||
|
||||
HashMap<String,String> map = new HashMap<>();
|
||||
map.put("id",String.valueOf(auction_id));
|
||||
|
||||
//메시지 저장
|
||||
// if(landRequest.getMassageList()!= null && !landRequest.getMassageList().isEmpty()){
|
||||
// landRequest.getMassageList().forEach(
|
||||
// item -> {
|
||||
// map.put("title",item.getTitle());
|
||||
// map.put("content",item.getContent());
|
||||
// map.put("language",item.getLanguage());
|
||||
// landMapper.insertMessage(map);
|
||||
// }
|
||||
// );
|
||||
// }
|
||||
// log.info("AdminToolDB Message Save Complete");
|
||||
|
||||
LandAuction auction_info = landMapper.getLandAuctionDetail(auction_id);
|
||||
auction_info.setMessageList(landMapper.getMessage(auction_id));
|
||||
|
||||
mysqlHistoryLogService.insertHistoryLog(
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_ADD,
|
||||
MysqlConstants.TABLE_NAME_LAND_AUCTION,
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_ADD.name(),
|
||||
auction_info
|
||||
);
|
||||
log.info("AdminToolDB LandAuction Save id: {}", landRequest.getId());
|
||||
|
||||
dynamodbLandAuctionService.insertLandAuctionRegistryWithActivity(landRequest);
|
||||
|
||||
@@ -434,6 +402,7 @@ public class LandService {
|
||||
.build();
|
||||
}
|
||||
|
||||
@BusinessProcess(action = LogAction.LAND_OWNER_CHANGE)
|
||||
@Transactional(transactionManager = "transactionManager")
|
||||
public LandResponse postLandOwnerChanges(LandRequest landRequest){
|
||||
String guid = landRequest.getUserGuid();
|
||||
@@ -469,25 +438,7 @@ public class LandService {
|
||||
}
|
||||
|
||||
int result = landMapper.postLandOwnerChange(landRequest);
|
||||
try {
|
||||
log.info("AdminToolDB LandOwnerChanges Save: {}", objectMapper.writeValueAsString(landRequest));
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
long id = landRequest.getId();
|
||||
|
||||
HashMap<String,Object> map = new HashMap<>();
|
||||
map.put("id",String.valueOf(id));
|
||||
|
||||
LandOwnerChange info = landMapper.getLandOwnerChangeDetail(id);
|
||||
|
||||
mysqlHistoryLogService.insertHistoryLog(
|
||||
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_ADD,
|
||||
MysqlConstants.TABLE_NAME_LAND_OWNER_CHANGE,
|
||||
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_ADD.name(),
|
||||
info
|
||||
);
|
||||
log.info("AdminToolDB LandOwnerChanges Save id: {}", landRequest.getId());
|
||||
|
||||
// if(!is_reserve){
|
||||
// dynamodbLandService.ChangesLandOwner(landRequest);
|
||||
@@ -505,6 +456,7 @@ public class LandService {
|
||||
.build();
|
||||
}
|
||||
|
||||
@BusinessProcess(action = LogAction.LAND_AUCTION)
|
||||
@Transactional(transactionManager = "transactionManager")
|
||||
public LandResponse updateLandAuction(Long id, LandRequest landRequest) {
|
||||
landRequest.setId(id);
|
||||
@@ -512,7 +464,6 @@ public class LandService {
|
||||
landRequest.setUpdateDt(LocalDateTime.now());
|
||||
|
||||
LandAuction before_info = landMapper.getLandAuctionDetail(id);
|
||||
// before_info.setMessageList(landMapper.getMessage(id));
|
||||
|
||||
if(!before_info.getStatus().equals(LandAuction.AUCTION_STATUS.WAIT) && !before_info.getStatus().equals(LandAuction.AUCTION_STATUS.RESV_START)){
|
||||
return LandResponse.builder()
|
||||
@@ -522,40 +473,10 @@ public class LandService {
|
||||
}
|
||||
|
||||
int result = landMapper.updateLandAuction(landRequest);
|
||||
log.info("AdminToolDB LandAuction Update Complete: {}", landRequest);
|
||||
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("id", String.valueOf(id));
|
||||
|
||||
// message 테이블 데이터 삭제 처리 by mail_id
|
||||
// landMapper.deleteMessage(map);
|
||||
//
|
||||
// // 메시지 업데이트
|
||||
// if (landRequest.getMassageList() != null && !landRequest.getMassageList().isEmpty()) {
|
||||
// landRequest.getMassageList().forEach(item -> {
|
||||
// map.put("title", item.getTitle());
|
||||
// map.put("content", item.getContent());
|
||||
// map.put("language", item.getLanguage());
|
||||
//
|
||||
// landMapper.insertMessage(map);
|
||||
// });
|
||||
// }
|
||||
// log.info("AdminToolDB Message Update Complete");
|
||||
|
||||
LandAuction after_info = landMapper.getLandAuctionDetail(id);
|
||||
// after_info.setMessageList(landMapper.getMessage(id));
|
||||
|
||||
mysqlHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_UPDATE,
|
||||
MysqlConstants.TABLE_NAME_LAND_AUCTION,
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_UPDATE.name(),
|
||||
before_info,
|
||||
after_info
|
||||
);
|
||||
log.info("AdminToolDB LandAuction Update Complete id: {}", id);
|
||||
|
||||
dynamodbLandAuctionService.updateLandAuction(landRequest);
|
||||
|
||||
|
||||
return LandResponse.builder()
|
||||
.resultData(LandResponse.ResultData.builder()
|
||||
.build())
|
||||
@@ -564,29 +485,15 @@ public class LandService {
|
||||
.build();
|
||||
}
|
||||
|
||||
@BusinessProcess(action = LogAction.LAND_OWNER_CHANGE)
|
||||
@Transactional(transactionManager = "transactionManager")
|
||||
public LandResponse updateLandOwnerChanges(Long id, LandRequest landRequest) {
|
||||
landRequest.setId(id);
|
||||
landRequest.setUpdateBy(CommonUtils.getAdmin().getId());
|
||||
landRequest.setUpdateDt(LocalDateTime.now());
|
||||
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("id", String.valueOf(id));
|
||||
|
||||
LandOwnerChange before_info = landMapper.getLandOwnerChangeDetail(id);
|
||||
|
||||
int result = landMapper.updateLandOwnerChange(landRequest);
|
||||
log.info("AdminToolDB LandOwnerChanges Update Complete: {}", landRequest);
|
||||
|
||||
LandOwnerChange after_info = landMapper.getLandOwnerChangeDetail(id);
|
||||
|
||||
mysqlHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_UPDATE,
|
||||
MysqlConstants.TABLE_NAME_LAND_OWNER_CHANGE,
|
||||
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_UPDATE.name(),
|
||||
before_info,
|
||||
after_info
|
||||
);
|
||||
log.info("AdminToolDB LandOwnerChanges Update Complete id: {}", id);
|
||||
|
||||
dynamodbLandService.ChangesLandOwner(landRequest);
|
||||
|
||||
@@ -598,6 +505,7 @@ public class LandService {
|
||||
.build();
|
||||
}
|
||||
|
||||
@BusinessProcess(action = LogAction.LAND_AUCTION)
|
||||
@Transactional(transactionManager = "transactionManager")
|
||||
public LandResponse deleteLandAuction(LandRequest landRequest){
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
@@ -607,7 +515,6 @@ public class LandService {
|
||||
item->{
|
||||
Long auction_id = item.getId();
|
||||
LandAuction auction_info = landMapper.getLandAuctionDetail(auction_id);
|
||||
auction_info.setMessageList(landMapper.getMessage(auction_id));
|
||||
|
||||
if(!auction_info.getStatus().equals(LandAuction.AUCTION_STATUS.WAIT) && !auction_info.getStatus().equals(LandAuction.AUCTION_STATUS.RESV_START)){
|
||||
is_falil.set(true);
|
||||
@@ -616,15 +523,10 @@ public class LandService {
|
||||
|
||||
map.put("id", auction_id);
|
||||
map.put("updateBy", CommonUtils.getAdmin().getId());
|
||||
int result = landMapper.deleteLandAuction(map);
|
||||
log.info("LandAuction Delete Complete: {}", item);
|
||||
|
||||
mysqlHistoryLogService.deleteHistoryLog(
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_DELETE,
|
||||
MysqlConstants.TABLE_NAME_LAND_AUCTION,
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_DELETE.name(),
|
||||
auction_info
|
||||
);
|
||||
int result = landMapper.deleteLandAuction(map);
|
||||
|
||||
log.info("LandAuction Delete Complete id: {}", auction_id);
|
||||
|
||||
dynamodbLandAuctionService.cancelLandAuction(auction_info);
|
||||
}
|
||||
@@ -645,6 +547,7 @@ public class LandService {
|
||||
.build();
|
||||
}
|
||||
|
||||
@BusinessProcess(action = LogAction.LAND_OWNER_CHANGE)
|
||||
@Transactional(transactionManager = "transactionManager")
|
||||
public LandResponse deleteLandOwnerChanges(LandRequest landRequest){
|
||||
Long id = landRequest.getId();
|
||||
@@ -662,14 +565,7 @@ public class LandService {
|
||||
map.put("id", id);
|
||||
map.put("updateBy", CommonUtils.getAdmin().getId());
|
||||
int result = landMapper.deleteLandOwnerChanges(map);
|
||||
log.info("LandOwnerChanges Delete Complete: {}", landRequest);
|
||||
|
||||
mysqlHistoryLogService.deleteHistoryLog(
|
||||
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_DELETE,
|
||||
MysqlConstants.TABLE_NAME_LAND_OWNER_CHANGE,
|
||||
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_DELETE.name(),
|
||||
info
|
||||
);
|
||||
log.info("LandOwnerChanges Delete Complete id: {}", id);
|
||||
|
||||
return LandResponse.builder()
|
||||
.resultData(LandResponse.ResultData.builder()
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
package com.caliverse.admin.domain.service;
|
||||
|
||||
import com.caliverse.admin.domain.dao.admin.HistoryMapper;
|
||||
import com.caliverse.admin.domain.dao.admin.MailMapper;
|
||||
import com.caliverse.admin.domain.dao.total.WalletUserMapper;
|
||||
import com.caliverse.admin.domain.datacomponent.MetaDataHandler;
|
||||
import com.caliverse.admin.domain.entity.*;
|
||||
import com.caliverse.admin.domain.entity.log.LogAction;
|
||||
import com.caliverse.admin.domain.entity.log.LogStatus;
|
||||
import com.caliverse.admin.domain.request.MailRequest;
|
||||
import com.caliverse.admin.domain.response.MailResponse;
|
||||
import com.caliverse.admin.dynamodb.service.DynamodbCaliumService;
|
||||
import com.caliverse.admin.dynamodb.service.DynamodbUserService;
|
||||
import com.caliverse.admin.global.common.annotation.BusinessProcess;
|
||||
import com.caliverse.admin.global.common.code.CommonCode;
|
||||
import com.caliverse.admin.global.common.code.ErrorCode;
|
||||
import com.caliverse.admin.global.common.code.SuccessCode;
|
||||
@@ -17,6 +19,7 @@ import com.caliverse.admin.global.common.constants.MysqlConstants;
|
||||
import com.caliverse.admin.global.common.exception.RestApiException;
|
||||
import com.caliverse.admin.global.common.utils.CommonUtils;
|
||||
import com.caliverse.admin.global.common.utils.ExcelUtils;
|
||||
import com.caliverse.admin.global.component.manager.BusinessProcessIdManager;
|
||||
import com.caliverse.admin.mongodb.service.MysqlHistoryLogService;
|
||||
import com.caliverse.admin.scheduler.ScheduleService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -26,6 +29,8 @@ import org.springframework.core.io.Resource;
|
||||
import org.springframework.core.io.UrlResource;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.support.TransactionSynchronization;
|
||||
import org.springframework.transaction.support.TransactionSynchronizationManager;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.core.io.ResourceLoader;
|
||||
|
||||
@@ -47,13 +52,13 @@ public class MailService {
|
||||
private String samplePath;
|
||||
private final ExcelUtils excelUtils;
|
||||
private final MailMapper mailMapper;
|
||||
private final HistoryMapper historyMapper;
|
||||
private final MetaDataHandler metaDataHandler;
|
||||
private final ResourceLoader resourceLoader;
|
||||
private final ScheduleService scheduleService;
|
||||
private final HistoryService historyService;
|
||||
private final DynamodbCaliumService dynamodbCaliumService;
|
||||
private final MysqlHistoryLogService mysqlHistoryLogService;
|
||||
private final BusinessProcessIdManager processIdManager;
|
||||
|
||||
public MailResponse getStockCalium(){
|
||||
double stock_calium = dynamodbCaliumService.getCaliumTotal();
|
||||
@@ -168,6 +173,7 @@ public class MailService {
|
||||
}
|
||||
}
|
||||
|
||||
@BusinessProcess(action = LogAction.MAIL)
|
||||
@Transactional(transactionManager = "transactionManager")
|
||||
public MailResponse postMail(MailRequest mailRequest){
|
||||
mailRequest.setCreateBy(CommonUtils.getAdmin().getId());
|
||||
@@ -274,7 +280,6 @@ public class MailService {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//메시지 저장
|
||||
if(mailRequest.getMailList()!= null && !mailRequest.getMailList().isEmpty()){
|
||||
mailRequest.getMailList().forEach(
|
||||
@@ -292,12 +297,24 @@ public class MailService {
|
||||
info.setMailList(mailMapper.getMessage(mailRequest.getId()));
|
||||
info.setItemList(mailMapper.getItem(mailRequest.getId()));
|
||||
|
||||
String prodId = processIdManager.getCurrentProcessId();
|
||||
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
|
||||
@Override
|
||||
public void afterCommit() {
|
||||
try {
|
||||
mysqlHistoryLogService.insertHistoryLog(
|
||||
HISTORYTYPEDETAIL.MAIL_ADD,
|
||||
prodId,
|
||||
LogAction.MAIL,
|
||||
LogStatus.SUCCESS,
|
||||
MysqlConstants.TABLE_NAME_MAIL,
|
||||
HISTORYTYPEDETAIL.MAIL_ADD.name(),
|
||||
"",
|
||||
info
|
||||
);
|
||||
} catch (Exception e) {
|
||||
log.warn("Failed to log mail creation: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return MailResponse.builder()
|
||||
.status(CommonCode.SUCCESS.getHttpStatus())
|
||||
@@ -307,6 +324,8 @@ public class MailService {
|
||||
.build())
|
||||
.build();
|
||||
}
|
||||
|
||||
@BusinessProcess(action = LogAction.MAIL)
|
||||
@Transactional(transactionManager = "transactionManager")
|
||||
public MailResponse updateMail(Long id, MailRequest mailRequest) {
|
||||
mailRequest.setId(id);
|
||||
@@ -341,8 +360,6 @@ public class MailService {
|
||||
before_info.setMailList(mailMapper.getMessage(mail_id));
|
||||
before_info.setItemList(mailMapper.getItem(mail_id));
|
||||
|
||||
log.info("updateMail Update Before MailInfo: {}", before_info);
|
||||
|
||||
mailMapper.updateMail(mailRequest);
|
||||
|
||||
// 스케줄에서 제거
|
||||
@@ -377,30 +394,31 @@ public class MailService {
|
||||
mailMapper.insertMessage(map);
|
||||
});
|
||||
}
|
||||
log.info("updateMail Update After Mail: {}", mailRequest);
|
||||
log.info("updateMail Update Complete Mail Id: {}", mailRequest.getId());
|
||||
|
||||
Mail after_info = mailMapper.getMailDetail(mail_id);
|
||||
after_info.setMailList(mailMapper.getMessage(mail_id));
|
||||
after_info.setItemList(mailMapper.getItem(mail_id));
|
||||
|
||||
String prodId = processIdManager.getCurrentProcessId();
|
||||
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
|
||||
@Override
|
||||
public void afterCommit() {
|
||||
try {
|
||||
mysqlHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPEDETAIL.MAIL_UPDATE,
|
||||
prodId,
|
||||
LogAction.MAIL,
|
||||
LogStatus.SUCCESS,
|
||||
MysqlConstants.TABLE_NAME_MAIL,
|
||||
HISTORYTYPEDETAIL.MAIL_UPDATE.name(),
|
||||
"",
|
||||
before_info,
|
||||
after_info
|
||||
);
|
||||
|
||||
//로그 기록
|
||||
// JSONObject jsonObject = new JSONObject();
|
||||
// jsonObject.put("before_info",before_info.toString());
|
||||
// jsonObject.put("mail_type",mailRequest.getMailType());
|
||||
// jsonObject.put("receiver",mailRequest.getTarget());
|
||||
// Mail.SENDTYPE sendType = mailRequest.getSendType();
|
||||
// jsonObject.put("send_type",sendType);
|
||||
// if(sendType.equals(Mail.SENDTYPE.RESERVE_SEND))
|
||||
// jsonObject.put("send_dt",mailRequest.getSendDt());
|
||||
// historyService.setLog(HISTORYTYPE.MAIL_UPDATE, jsonObject);
|
||||
} catch (Exception e) {
|
||||
log.warn("Failed to log mail creation: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return MailResponse.builder()
|
||||
.status(CommonCode.SUCCESS.getHttpStatus())
|
||||
@@ -411,6 +429,7 @@ public class MailService {
|
||||
.build();
|
||||
}
|
||||
|
||||
@BusinessProcess(action = LogAction.MAIL)
|
||||
@Transactional(transactionManager = "transactionManager")
|
||||
public MailResponse deleteMail(MailRequest mailRequest){
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
@@ -419,8 +438,6 @@ public class MailService {
|
||||
item->{
|
||||
long id = item.getId();
|
||||
|
||||
Mail info = mailMapper.getMailDetail(id);
|
||||
|
||||
map.put("id",id);
|
||||
mailMapper.deleteMail(map);
|
||||
|
||||
@@ -428,25 +445,6 @@ public class MailService {
|
||||
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);
|
||||
}
|
||||
);
|
||||
|
||||
@@ -471,6 +469,7 @@ public class MailService {
|
||||
return mailMapper.getItem(id);
|
||||
}
|
||||
|
||||
@Transactional(transactionManager = "transactionManager")
|
||||
public void updateMailStatus(Long id, Mail.SENDSTATUS status){
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
map.put("id", id);
|
||||
@@ -514,9 +513,4 @@ public class MailService {
|
||||
}
|
||||
return target;
|
||||
}
|
||||
|
||||
public void setScheduleLog(HISTORYTYPEDETAIL type, String message){
|
||||
//스케줄 로그 기록
|
||||
historyService.setScheduleLog(type, message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,9 +3,12 @@ package com.caliverse.admin.domain.service;
|
||||
import com.caliverse.admin.domain.RabbitMq.MessageHandlerService;
|
||||
import com.caliverse.admin.domain.dao.admin.MenuMapper;
|
||||
import com.caliverse.admin.domain.entity.*;
|
||||
import com.caliverse.admin.domain.entity.log.LogAction;
|
||||
import com.caliverse.admin.domain.entity.log.LogStatus;
|
||||
import com.caliverse.admin.domain.request.MenuRequest;
|
||||
import com.caliverse.admin.domain.response.MenuResponse;
|
||||
import com.caliverse.admin.dynamodb.service.DynamodbMenuService;
|
||||
import com.caliverse.admin.global.common.annotation.BusinessProcess;
|
||||
import com.caliverse.admin.global.common.code.CommonCode;
|
||||
import com.caliverse.admin.global.common.code.ErrorCode;
|
||||
import com.caliverse.admin.global.common.code.SuccessCode;
|
||||
@@ -14,6 +17,7 @@ import com.caliverse.admin.global.common.constants.MysqlConstants;
|
||||
import com.caliverse.admin.global.common.exception.RestApiException;
|
||||
import com.caliverse.admin.global.common.utils.CommonUtils;
|
||||
import com.caliverse.admin.global.common.utils.FileUtils;
|
||||
import com.caliverse.admin.global.component.manager.BusinessProcessIdManager;
|
||||
import com.caliverse.admin.mongodb.service.MysqlHistoryLogService;
|
||||
import com.caliverse.admin.redis.service.RedisUserInfoService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -24,6 +28,8 @@ import org.springframework.core.io.ResourceLoader;
|
||||
import org.springframework.core.io.UrlResource;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.support.TransactionSynchronization;
|
||||
import org.springframework.transaction.support.TransactionSynchronizationManager;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import software.amazon.awssdk.services.s3.model.S3Exception;
|
||||
|
||||
@@ -53,6 +59,7 @@ public class MenuService {
|
||||
private final DynamodbMenuService dynamodbMenuService;
|
||||
private final MessageHandlerService messageHandlerService;
|
||||
private final RedisUserInfoService redisUserInfoService;
|
||||
private final BusinessProcessIdManager processIdManager;
|
||||
|
||||
public MenuResponse getList(Map requestParam){
|
||||
|
||||
@@ -91,6 +98,7 @@ public class MenuService {
|
||||
|
||||
public MenuResponse imageUpload(MultipartFile file){
|
||||
if (file.isEmpty()) {
|
||||
log.error("File is empty");
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.NOT_EXIT_FILE.toString());
|
||||
}
|
||||
|
||||
@@ -151,6 +159,7 @@ public class MenuService {
|
||||
}
|
||||
}
|
||||
|
||||
@BusinessProcess(action = LogAction.BANNER)
|
||||
@Transactional(transactionManager = "transactionManager")
|
||||
public MenuResponse postBanner(MenuRequest menuRequest){
|
||||
menuRequest.setCreateBy(CommonUtils.getAdmin().getId());
|
||||
@@ -208,12 +217,31 @@ public class MenuService {
|
||||
MenuBanner banner = menuMapper.getBannerDetail(menuRequest.getId());
|
||||
banner.setImageList(menuMapper.getMessage(menuRequest.getId()));
|
||||
|
||||
String prodId = processIdManager.getCurrentProcessId();
|
||||
LogAction action = processIdManager.getCurrentAction();
|
||||
|
||||
//message 정보까지 저장해야해서 수동 로그
|
||||
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
|
||||
@Override
|
||||
public void afterCommit() {
|
||||
try {
|
||||
mysqlHistoryLogService.insertHistoryLog(
|
||||
HISTORYTYPEDETAIL.MENU_BANNER_ADD,
|
||||
prodId,
|
||||
action,
|
||||
LogStatus.SUCCESS,
|
||||
MysqlConstants.TABLE_NAME_MENU_BANNER,
|
||||
HISTORYTYPEDETAIL.MENU_BANNER_ADD.name(),
|
||||
"",
|
||||
banner
|
||||
);
|
||||
} catch (Exception e) {
|
||||
log.warn("Failed to log banner creation: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if(redisUserInfoService.getAllServerList().isEmpty()){
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.NOT_FOUND_SERVER.getMessage());
|
||||
}
|
||||
|
||||
dynamodbMenuService.insertBanner(banner);
|
||||
|
||||
@@ -229,6 +257,7 @@ public class MenuService {
|
||||
.build();
|
||||
}
|
||||
|
||||
@BusinessProcess(action = LogAction.BANNER)
|
||||
@Transactional(transactionManager = "transactionManager")
|
||||
public MenuResponse updateBanner(Long id, MenuRequest menuRequest) {
|
||||
menuRequest.setId(id);
|
||||
@@ -244,34 +273,14 @@ public class MenuService {
|
||||
|
||||
menuMapper.updateBanner(menuRequest);
|
||||
|
||||
// Map<String, String> map = new HashMap<>();
|
||||
// map.put("id", String.valueOf(menuRequest.getId()));
|
||||
|
||||
// menuMapper.deleteMessage(map);
|
||||
//
|
||||
// if(menuRequest.getImageList()!= null && !menuRequest.getImageList().isEmpty()){
|
||||
// menuRequest.getImageList().forEach(image -> {
|
||||
// map.put("title", image.getContent());
|
||||
// map.put("language", image.getLanguage());
|
||||
// if(menuRequest.isLink() && menuRequest.getLinkList() != null && !menuRequest.getLinkList().isEmpty()){
|
||||
// String link = menuRequest.getLinkList().stream().filter(data -> data.getLanguage().equals(image.getLanguage())).findFirst().get().getContent();
|
||||
// map.put("content", link);
|
||||
// }
|
||||
// menuMapper.insertMessage(map);
|
||||
// });
|
||||
// }
|
||||
log.info("updateBanner Update After Banner: {}", menuRequest);
|
||||
|
||||
MenuBanner after_info = menuMapper.getBannerDetail(banner_id);
|
||||
after_info.setImageList(menuMapper.getMessage(banner_id));
|
||||
|
||||
mysqlHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPEDETAIL.MENU_BANNER_UPDATE,
|
||||
MysqlConstants.TABLE_NAME_MENU_BANNER,
|
||||
HISTORYTYPEDETAIL.MENU_BANNER_UPDATE.name(),
|
||||
before_info,
|
||||
after_info
|
||||
);
|
||||
if(redisUserInfoService.getAllServerList().isEmpty()){
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.NOT_FOUND_SERVER.getMessage());
|
||||
}
|
||||
|
||||
dynamodbMenuService.updateBanner(after_info);
|
||||
|
||||
@@ -287,6 +296,7 @@ public class MenuService {
|
||||
.build();
|
||||
}
|
||||
|
||||
@BusinessProcess(action = LogAction.BANNER)
|
||||
@Transactional(transactionManager = "transactionManager")
|
||||
public MenuResponse deleteBanner(Long id){
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
@@ -306,13 +316,11 @@ public class MenuService {
|
||||
}
|
||||
|
||||
menuMapper.deleteBanner(map);
|
||||
menuMapper.deleteMessage(map);
|
||||
|
||||
mysqlHistoryLogService.deleteHistoryLog(
|
||||
HISTORYTYPEDETAIL.MENU_BANNER_DELETE,
|
||||
MysqlConstants.TABLE_NAME_MENU_BANNER,
|
||||
HISTORYTYPEDETAIL.MENU_BANNER_DELETE.name(),
|
||||
banner
|
||||
);
|
||||
if(redisUserInfoService.getAllServerList().isEmpty()){
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.NOT_FOUND_SERVER.getMessage());
|
||||
}
|
||||
|
||||
dynamodbMenuService.deleteBanner(banner.getId().intValue());
|
||||
|
||||
|
||||
@@ -1,23 +1,26 @@
|
||||
package com.caliverse.admin.domain.service;
|
||||
|
||||
import com.caliverse.admin.domain.dao.admin.HistoryMapper;
|
||||
import com.caliverse.admin.domain.dao.admin.NoticeMapper;
|
||||
import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
|
||||
import com.caliverse.admin.domain.entity.InGame;
|
||||
import com.caliverse.admin.domain.entity.Message;
|
||||
import com.caliverse.admin.domain.entity.log.LogAction;
|
||||
import com.caliverse.admin.domain.entity.log.LogStatus;
|
||||
import com.caliverse.admin.domain.request.NoticeRequest;
|
||||
import com.caliverse.admin.domain.response.NoticeResponse;
|
||||
import com.caliverse.admin.global.common.annotation.BusinessProcess;
|
||||
import com.caliverse.admin.global.common.code.CommonCode;
|
||||
import com.caliverse.admin.global.common.code.SuccessCode;
|
||||
import com.caliverse.admin.global.common.constants.MysqlConstants;
|
||||
import com.caliverse.admin.global.common.utils.CommonUtils;
|
||||
import com.caliverse.admin.global.component.manager.BusinessProcessIdManager;
|
||||
import com.caliverse.admin.mongodb.service.MysqlHistoryLogService;
|
||||
import com.caliverse.admin.scheduler.ScheduleService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.json.JSONObject;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.support.TransactionSynchronization;
|
||||
import org.springframework.transaction.support.TransactionSynchronizationManager;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -30,10 +33,9 @@ import java.util.stream.Collectors;
|
||||
public class NoticeService {
|
||||
|
||||
private final NoticeMapper noticeMapper;
|
||||
private final HistoryMapper historyMapper;
|
||||
private final ScheduleService scheduleService;
|
||||
private final HistoryService historyService;
|
||||
private final MysqlHistoryLogService mysqlHistoryLogService;
|
||||
private final BusinessProcessIdManager processIdManager;
|
||||
|
||||
public NoticeResponse getNoticeList(){
|
||||
|
||||
@@ -77,6 +79,7 @@ public class NoticeService {
|
||||
}
|
||||
|
||||
//인게임 메시지 등록
|
||||
@BusinessProcess(action = LogAction.NOTICE)
|
||||
@Transactional(transactionManager = "transactionManager")
|
||||
public NoticeResponse postInGameMessage(NoticeRequest noticeRequest){
|
||||
// 등록자는 메일로 넣어주자
|
||||
@@ -98,13 +101,27 @@ public class NoticeService {
|
||||
}
|
||||
log.info("postInGameMessage notice: {}", noticeRequest);
|
||||
|
||||
mysqlHistoryLogService.insertHistoryLog(
|
||||
HISTORYTYPEDETAIL.NOTICE_ADD,
|
||||
MysqlConstants.TABLE_NAME_NOTICE,
|
||||
HISTORYTYPEDETAIL.NOTICE_ADD.name(),
|
||||
noticeMapper.getNoticeDetail(noticeRequest.getId())
|
||||
);
|
||||
InGame info = noticeMapper.getNoticeDetail(noticeRequest.getId());
|
||||
info.setMessageList(noticeMapper.getMessage(noticeRequest.getId()));
|
||||
|
||||
String prodId = processIdManager.getCurrentProcessId();
|
||||
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
|
||||
@Override
|
||||
public void afterCommit() {
|
||||
try {
|
||||
mysqlHistoryLogService.insertHistoryLog(
|
||||
prodId,
|
||||
LogAction.NOTICE,
|
||||
LogStatus.SUCCESS,
|
||||
MysqlConstants.TABLE_NAME_NOTICE,
|
||||
"",
|
||||
info
|
||||
);
|
||||
} catch (Exception e) {
|
||||
log.warn("Failed to log notice creation: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return NoticeResponse.builder()
|
||||
.resultData(NoticeResponse.ResultData.builder().message(SuccessCode.REGISTRATION.getMessage()).build())
|
||||
@@ -113,16 +130,19 @@ public class NoticeService {
|
||||
.build();
|
||||
}
|
||||
|
||||
@BusinessProcess(action = LogAction.NOTICE)
|
||||
@Transactional(transactionManager = "transactionManager")
|
||||
public NoticeResponse updateInGameMessage(Long id, NoticeRequest noticeRequest){
|
||||
noticeRequest.setId(id);
|
||||
noticeRequest.setUpdateBy(CommonUtils.getAdmin().getId());
|
||||
|
||||
InGame before_info = noticeMapper.getNoticeDetail(id);
|
||||
before_info.setMessageList(noticeMapper.getMessage(id));
|
||||
|
||||
int i = noticeMapper.updateNotice(noticeRequest);
|
||||
// 스케줄에서 기존 등록 제거
|
||||
scheduleService.closeTask(noticeRequest.getId().toString());
|
||||
|
||||
if(i > 0){
|
||||
InGame before_notice = noticeMapper.getNoticeDetail(noticeRequest.getId());
|
||||
log.info("updateInGameMessage Before notice: {}", before_notice);
|
||||
@@ -148,13 +168,29 @@ public class NoticeService {
|
||||
}
|
||||
log.info("updateInGameMessage After notice: {}", noticeRequest);
|
||||
|
||||
InGame info = noticeMapper.getNoticeDetail(noticeRequest.getId());
|
||||
info.setMessageList(noticeMapper.getMessage(noticeRequest.getId()));
|
||||
|
||||
String prodId = processIdManager.getCurrentProcessId();
|
||||
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
|
||||
@Override
|
||||
public void afterCommit() {
|
||||
try {
|
||||
mysqlHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPEDETAIL.NOTICE_UPDATE,
|
||||
prodId,
|
||||
LogAction.NOTICE,
|
||||
LogStatus.SUCCESS,
|
||||
MysqlConstants.TABLE_NAME_NOTICE,
|
||||
HISTORYTYPEDETAIL.NOTICE_UPDATE.name(),
|
||||
"",
|
||||
before_info,
|
||||
noticeMapper.getNoticeDetail(id)
|
||||
info
|
||||
);
|
||||
} catch (Exception e) {
|
||||
log.warn("Failed to log notice creation: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return NoticeResponse.builder()
|
||||
.resultData(NoticeResponse.ResultData.builder().message(SuccessCode.UPDATE.getMessage()).build())
|
||||
.result(CommonCode.SUCCESS.getResult())
|
||||
@@ -162,6 +198,7 @@ public class NoticeService {
|
||||
.build();
|
||||
}
|
||||
|
||||
@BusinessProcess(action = LogAction.NOTICE)
|
||||
@Transactional(transactionManager = "transactionManager")
|
||||
public NoticeResponse deleteInGameMessage(NoticeRequest noticeRequest){
|
||||
|
||||
@@ -169,26 +206,16 @@ public class NoticeService {
|
||||
noticeRequest.getList().forEach(
|
||||
item->{
|
||||
|
||||
//사용자 로그 기록 (인게임 메시지 삭제)
|
||||
String message = noticeMapper.getMessageById(item.getMessageId());
|
||||
|
||||
noticeMapper.deleteNotice(item.getMessageId());
|
||||
noticeMapper.deleteNotice(item.getId());
|
||||
|
||||
// 스케줄에서 제거
|
||||
scheduleService.closeTask("notice-" + item.getMessageId());
|
||||
scheduleService.closeTask("notice-" + item.getId());
|
||||
|
||||
log.info("deleteInGameMessage notice: {}", item);
|
||||
|
||||
mysqlHistoryLogService.deleteHistoryLog(
|
||||
HISTORYTYPEDETAIL.NOTICE_DELETE,
|
||||
MysqlConstants.TABLE_NAME_NOTICE,
|
||||
HISTORYTYPEDETAIL.NOTICE_DELETE.name(),
|
||||
noticeMapper.getNoticeDetail(item.getMessageId())
|
||||
);
|
||||
|
||||
}
|
||||
);
|
||||
log.info("deleteInGameMessage notice: {}", noticeRequest);
|
||||
log.info("deleteInGameMessage notice id: {}", noticeRequest.getList().get(0).getId());
|
||||
return NoticeResponse.builder()
|
||||
.resultData(NoticeResponse.ResultData.builder().message(SuccessCode.DELETE.getMessage()).build())
|
||||
.result(CommonCode.SUCCESS.getResult())
|
||||
@@ -204,6 +231,7 @@ public class NoticeService {
|
||||
return noticeMapper.getMessage(id);
|
||||
}
|
||||
|
||||
@Transactional(transactionManager = "transactionManager")
|
||||
public void updateNoticeStatus(Long id, InGame.SENDSTATUS status){
|
||||
HashMap map = new HashMap();
|
||||
map.put("id", id);
|
||||
@@ -215,16 +243,4 @@ public class NoticeService {
|
||||
noticeMapper.updateCountNotice(id);
|
||||
}
|
||||
|
||||
public void setScheduleLog(HISTORYTYPEDETAIL type, String message){
|
||||
//스케줄 로그 기록
|
||||
Map<String, Object> logMap = new HashMap<>();
|
||||
logMap.put("adminId", 1);
|
||||
logMap.put("name", "schedule");
|
||||
logMap.put("mail", "schedule");
|
||||
logMap.put("type", type);
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("message",message);
|
||||
logMap.put("content",jsonObject.toString());
|
||||
historyMapper.saveLog(logMap);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.caliverse.admin.domain.service;
|
||||
|
||||
import com.caliverse.admin.global.common.utils.CommonUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -53,7 +54,7 @@ public class S3Service {
|
||||
}
|
||||
|
||||
public String uploadFile(File file, String directoryName, String contentType) throws IOException, S3Exception {
|
||||
String fileName = UUID.randomUUID() + "-" + file.getName();
|
||||
String fileName = CommonUtils.getCreateGuId() + "-" + file.getName();
|
||||
|
||||
// S3 객체 키 (경로 + 파일명)
|
||||
String objectKey = String.format("%s/%s/%s", activeProfile, directoryName, fileName);
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.caliverse.admin.domain.service;
|
||||
|
||||
|
||||
import com.caliverse.admin.domain.RabbitMq.MessageHandlerService;
|
||||
import com.caliverse.admin.domain.entity.log.LogAction;
|
||||
import com.caliverse.admin.global.common.annotation.BusinessProcess;
|
||||
import com.caliverse.admin.global.common.code.CommonCode;
|
||||
import com.caliverse.admin.global.common.code.ErrorCode;
|
||||
import com.caliverse.admin.global.common.exception.RestApiException;
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.caliverse.admin.domain.RabbitMq.MessageHandlerService;
|
||||
import com.caliverse.admin.domain.entity.EReqType;
|
||||
import com.caliverse.admin.domain.entity.FriendRequest;
|
||||
import com.caliverse.admin.domain.entity.SEARCHTYPE;
|
||||
import com.caliverse.admin.domain.entity.log.LogAction;
|
||||
import com.caliverse.admin.domain.request.MailRequest;
|
||||
import com.caliverse.admin.dynamodb.domain.atrrib.AccountBaseAttrib;
|
||||
import com.caliverse.admin.dynamodb.domain.atrrib.MailAttrib;
|
||||
@@ -19,6 +20,7 @@ import com.caliverse.admin.dynamodb.domain.atrrib.MoneyAttrib;
|
||||
import com.caliverse.admin.dynamodb.domain.doc.MailDoc;
|
||||
import com.caliverse.admin.dynamodb.dto.PageResult;
|
||||
import com.caliverse.admin.dynamodb.service.*;
|
||||
import com.caliverse.admin.global.common.annotation.BusinessProcess;
|
||||
import com.caliverse.admin.global.common.constants.CommonConstants;
|
||||
import com.caliverse.admin.redis.service.RedisUserInfoService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -61,6 +63,7 @@ public class UsersService {
|
||||
private MetaDataHandler metaDataHandler;
|
||||
|
||||
// 닉네임 변경
|
||||
@BusinessProcess(action = LogAction.NICKNAME_CHANGE)
|
||||
public UsersResponse changeNickname(UsersRequest usersRequest){
|
||||
String guid = usersRequest.getGuid();
|
||||
String nickname = usersRequest.getNickname();
|
||||
@@ -86,6 +89,7 @@ public class UsersService {
|
||||
}
|
||||
|
||||
// GM 권한 변경
|
||||
@BusinessProcess(action = LogAction.ADMIN_LEVEL)
|
||||
public UsersResponse changeAdminLevel(UsersRequest usersRequest){
|
||||
String guid = usersRequest.getGuid();
|
||||
|
||||
@@ -102,6 +106,7 @@ public class UsersService {
|
||||
}
|
||||
|
||||
// 유저 킥
|
||||
@BusinessProcess(action = LogAction.KICK_USER)
|
||||
public UsersResponse userKick(UsersRequest usersRequest){
|
||||
String guid = usersRequest.getGuid();
|
||||
String adminUser = CommonUtils.getAdmin().getEmail();
|
||||
@@ -269,6 +274,7 @@ public class UsersService {
|
||||
}
|
||||
|
||||
//인벤토리 아이템 삭제
|
||||
@BusinessProcess(action = LogAction.ITEM)
|
||||
public UsersResponse deleteInventoryItem(Map<String, String> requestParams){
|
||||
String guid = requestParams.get("guid");
|
||||
String item_guid = requestParams.get("item_guid");
|
||||
@@ -381,6 +387,7 @@ public class UsersService {
|
||||
}
|
||||
|
||||
//우편 삭제
|
||||
@BusinessProcess(action = LogAction.MAIL)
|
||||
public UsersResponse deleteMail(Map<String, String> requestParams){
|
||||
String guid = requestParams.get("guid");
|
||||
String mail_guid = requestParams.get("mail_guid");
|
||||
@@ -399,6 +406,7 @@ public class UsersService {
|
||||
}
|
||||
|
||||
//우편 아이템 삭제
|
||||
@BusinessProcess(action = LogAction.MAIL_ITEM)
|
||||
public UsersResponse deleteMailItem(MailRequest.DeleteMailItem deleteMailItem){
|
||||
userGameSessionService.kickUserSession(deleteMailItem.getGuid(), "delete mail item");
|
||||
dynamodbMailService.deleteMailItem(deleteMailItem.getType(), deleteMailItem.getGuid(),
|
||||
@@ -510,6 +518,7 @@ public class UsersService {
|
||||
|
||||
}
|
||||
|
||||
@BusinessProcess(action = LogAction.QUEST_TASK)
|
||||
public UsersResponse CompleteQuestTask(UsersRequest usersRequest){
|
||||
String serverName = redisUserInfoService.getFirstChannel();
|
||||
if(serverName.isEmpty()){
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package com.caliverse.admin.dynamodb.repository;
|
||||
|
||||
import com.caliverse.admin.domain.entity.EFilterOperator;
|
||||
import com.caliverse.admin.domain.entity.log.LogAction;
|
||||
import com.caliverse.admin.domain.entity.log.LogStatus;
|
||||
import com.caliverse.admin.dynamodb.domain.doc.DynamoDBDocBase;
|
||||
import com.caliverse.admin.dynamodb.dto.PageResult;
|
||||
import com.caliverse.admin.dynamodb.service.DynamoDBOperations;
|
||||
import com.caliverse.admin.global.common.code.CommonCode;
|
||||
@@ -27,6 +30,22 @@ public abstract class BaseDynamoDBRepository<T> implements DynamoDBRepository<T>
|
||||
@Override
|
||||
public void save(T item) {
|
||||
operations.addPutItem(item, entityClass);
|
||||
|
||||
try {
|
||||
dynamodbHistoryLogService.insertHistoryLog(
|
||||
LogStatus.SUCCESS,
|
||||
"",
|
||||
(DynamoDBDocBase) item
|
||||
);
|
||||
|
||||
} catch (Exception e) {
|
||||
dynamodbHistoryLogService.insertHistoryLog(
|
||||
LogStatus.FAILURE,
|
||||
e.getMessage(),
|
||||
(DynamoDBDocBase) item
|
||||
);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -36,7 +55,32 @@ public abstract class BaseDynamoDBRepository<T> implements DynamoDBRepository<T>
|
||||
|
||||
@Override
|
||||
public void update(T item) {
|
||||
DynamoDBDocBase doc = (DynamoDBDocBase) item;
|
||||
Key key = Key.builder()
|
||||
.partitionValue(doc.getPK())
|
||||
.sortValue(doc.getSK())
|
||||
.build();
|
||||
T beforeDoc = findById(key);
|
||||
|
||||
operations.addUpdateItem(item, entityClass);
|
||||
|
||||
try {
|
||||
dynamodbHistoryLogService.updateHistoryLog(
|
||||
LogStatus.SUCCESS,
|
||||
"",
|
||||
(DynamoDBDocBase) beforeDoc,
|
||||
(DynamoDBDocBase) item
|
||||
);
|
||||
|
||||
} catch (Exception e) {
|
||||
dynamodbHistoryLogService.updateHistoryLog(
|
||||
LogStatus.FAILURE,
|
||||
e.getMessage(),
|
||||
null,
|
||||
(DynamoDBDocBase) item
|
||||
);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -46,7 +90,26 @@ public abstract class BaseDynamoDBRepository<T> implements DynamoDBRepository<T>
|
||||
|
||||
@Override
|
||||
public void delete(Key key) {
|
||||
T beforeDoc = findById(key);
|
||||
|
||||
operations.addDeleteItem(key, entityClass);
|
||||
|
||||
try {
|
||||
|
||||
dynamodbHistoryLogService.deleteHistoryLog(
|
||||
LogStatus.SUCCESS,
|
||||
"",
|
||||
(DynamoDBDocBase) beforeDoc
|
||||
);
|
||||
|
||||
} catch (Exception e) {
|
||||
dynamodbHistoryLogService.deleteHistoryLog(
|
||||
LogStatus.FAILURE,
|
||||
e.getMessage(),
|
||||
(DynamoDBDocBase) beforeDoc
|
||||
);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.caliverse.admin.dynamodb.repository.Impl;
|
||||
|
||||
import com.caliverse.admin.domain.entity.BlackList;
|
||||
import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
|
||||
import com.caliverse.admin.dynamodb.domain.atrrib.AccountBaseAttrib;
|
||||
import com.caliverse.admin.dynamodb.domain.doc.AccountBaseDoc;
|
||||
import com.caliverse.admin.dynamodb.entity.EAuthAdminLevelType;
|
||||
@@ -80,12 +79,6 @@ public class AccountBaseRepositoryImpl extends BaseDynamoDBRepository<AccountBas
|
||||
|
||||
log.info("updateBlockUserStart Update Success: {}", objectMapper.writeValueAsString(afterDoc));
|
||||
|
||||
dynamodbHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPEDETAIL.BLACKLIST_UPDATE,
|
||||
HISTORYTYPEDETAIL.BLACKLIST_UPDATE.name(),
|
||||
beforeDoc,
|
||||
afterDoc
|
||||
);
|
||||
}
|
||||
}catch (Exception e){
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
||||
@@ -120,12 +113,6 @@ public class AccountBaseRepositoryImpl extends BaseDynamoDBRepository<AccountBas
|
||||
|
||||
log.info("updateBlockUserEnd Update Success: {}", objectMapper.writeValueAsString(afterDoc));
|
||||
|
||||
dynamodbHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPEDETAIL.BLACKLIST_UPDATE,
|
||||
HISTORYTYPEDETAIL.BLACKLIST_UPDATE.name(),
|
||||
beforeDoc,
|
||||
afterDoc
|
||||
);
|
||||
}
|
||||
}catch (Exception e){
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
||||
@@ -155,12 +142,6 @@ public class AccountBaseRepositoryImpl extends BaseDynamoDBRepository<AccountBas
|
||||
|
||||
log.info("updateAdminLevel Update Success: {}", objectMapper.writeValueAsString(afterDoc));
|
||||
|
||||
dynamodbHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPEDETAIL.USER_ADMIN_AUTH_UPDATE,
|
||||
HISTORYTYPEDETAIL.USER_ADMIN_AUTH_UPDATE.name(),
|
||||
beforeDoc,
|
||||
afterDoc
|
||||
);
|
||||
}
|
||||
}catch (Exception e){
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
||||
|
||||
@@ -1,21 +1,13 @@
|
||||
package com.caliverse.admin.dynamodb.repository.Impl;
|
||||
|
||||
import com.caliverse.admin.domain.RabbitMq.message.BannerType;
|
||||
import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
|
||||
import com.caliverse.admin.domain.entity.MenuBanner;
|
||||
import com.caliverse.admin.domain.request.LandRequest;
|
||||
import com.caliverse.admin.domain.request.MenuRequest;
|
||||
import com.caliverse.admin.dynamodb.domain.atrrib.BannerAttrib;
|
||||
import com.caliverse.admin.dynamodb.domain.atrrib.BuildingAttrib;
|
||||
import com.caliverse.admin.dynamodb.domain.doc.BannerDoc;
|
||||
import com.caliverse.admin.dynamodb.domain.doc.BuildingDoc;
|
||||
import com.caliverse.admin.dynamodb.domain.doc.LandAuctionRegistryDoc;
|
||||
import com.caliverse.admin.dynamodb.entity.DynamodbOperationResult;
|
||||
import com.caliverse.admin.dynamodb.entity.ECurrencyType;
|
||||
import com.caliverse.admin.dynamodb.entity.ELanguageType;
|
||||
import com.caliverse.admin.dynamodb.repository.BannerRepository;
|
||||
import com.caliverse.admin.dynamodb.repository.BaseDynamoDBRepository;
|
||||
import com.caliverse.admin.dynamodb.repository.BuildingRepository;
|
||||
import com.caliverse.admin.dynamodb.service.DynamoDBOperations;
|
||||
import com.caliverse.admin.global.common.code.CommonCode;
|
||||
import com.caliverse.admin.global.common.code.ErrorCode;
|
||||
@@ -34,7 +26,6 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.caliverse.admin.global.common.utils.CommonUtils.convertUTCDate;
|
||||
import static com.caliverse.admin.global.common.utils.DateUtils.stringToISODateTime;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
@@ -105,14 +96,9 @@ public class BannerRepositoryImpl extends BaseDynamoDBRepository<BannerDoc> impl
|
||||
|
||||
log.info("BannerDoc Insert Success: {}", objectMapper.writeValueAsString(doc));
|
||||
|
||||
dynamodbHistoryLogService.insertHistoryLog(
|
||||
HISTORYTYPEDETAIL.MENU_BANNER_ADD,
|
||||
HISTORYTYPEDETAIL.MENU_BANNER_ADD.name(),
|
||||
doc
|
||||
);
|
||||
|
||||
}catch (Exception e){
|
||||
log.error("insert Error: {}", e.getMessage());
|
||||
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
||||
}
|
||||
}
|
||||
@@ -143,16 +129,10 @@ public class BannerRepositoryImpl extends BaseDynamoDBRepository<BannerDoc> impl
|
||||
update(afterDoc);
|
||||
|
||||
log.info("BannerDoc Update Success: {}", objectMapper.writeValueAsString(afterDoc));
|
||||
|
||||
dynamodbHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPEDETAIL.MENU_BANNER_UPDATE,
|
||||
HISTORYTYPEDETAIL.MENU_BANNER_UPDATE.name(),
|
||||
beforeDoc,
|
||||
afterDoc
|
||||
);
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("Update Error: {}", e.getMessage());
|
||||
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
||||
}
|
||||
}
|
||||
@@ -171,17 +151,12 @@ public class BannerRepositoryImpl extends BaseDynamoDBRepository<BannerDoc> impl
|
||||
|
||||
log.info("BannerDoc Delete Success: {}", objectMapper.writeValueAsString(doc));
|
||||
|
||||
dynamodbHistoryLogService.deleteHistoryLog(
|
||||
HISTORYTYPEDETAIL.MENU_BANNER_DELETE,
|
||||
HISTORYTYPEDETAIL.MENU_BANNER_DELETE.name(),
|
||||
doc
|
||||
);
|
||||
|
||||
return new DynamodbOperationResult(true, "", doc);
|
||||
}
|
||||
return new DynamodbOperationResult(true, "null", doc);
|
||||
}catch (Exception e){
|
||||
log.error("Delete Error: {}", e.getMessage());
|
||||
|
||||
return new DynamodbOperationResult(false, e.getMessage(), null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.caliverse.admin.dynamodb.repository.Impl;
|
||||
|
||||
import com.caliverse.admin.domain.entity.BattleEvent;
|
||||
import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
|
||||
import com.caliverse.admin.domain.entity.log.LogAction;
|
||||
import com.caliverse.admin.domain.entity.log.LogStatus;
|
||||
import com.caliverse.admin.domain.request.BattleEventRequest;
|
||||
import com.caliverse.admin.dynamodb.domain.atrrib.BattleEventAttrib;
|
||||
import com.caliverse.admin.dynamodb.domain.doc.BattleEventDoc;
|
||||
@@ -119,11 +121,6 @@ public class BattleEventRepositoryImpl extends BaseDynamoDBRepository<BattleEven
|
||||
|
||||
save(doc);
|
||||
|
||||
dynamodbHistoryLogService.insertHistoryLog(
|
||||
HISTORYTYPEDETAIL.BATTLE_EVENT_ADD,
|
||||
HISTORYTYPEDETAIL.BATTLE_EVENT_ADD.name(),
|
||||
doc
|
||||
);
|
||||
}catch (Exception e){
|
||||
log.error("insert Error: {}", e.getMessage());
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
||||
@@ -166,12 +163,6 @@ public class BattleEventRepositoryImpl extends BaseDynamoDBRepository<BattleEven
|
||||
|
||||
log.info("BattleEventDoc Update Success: {}", objectMapper.writeValueAsString(afterDoc));
|
||||
|
||||
dynamodbHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPEDETAIL.BATTLE_EVENT_UPDATE,
|
||||
HISTORYTYPEDETAIL.BATTLE_EVENT_UPDATE.name(),
|
||||
beforeDoc,
|
||||
afterDoc
|
||||
);
|
||||
}
|
||||
}catch (Exception e){
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
||||
@@ -197,12 +188,6 @@ public class BattleEventRepositoryImpl extends BaseDynamoDBRepository<BattleEven
|
||||
|
||||
log.info("BattleEventDoc Delete Success: {}", objectMapper.writeValueAsString(doc));
|
||||
|
||||
dynamodbHistoryLogService.deleteHistoryLog(
|
||||
HISTORYTYPEDETAIL.BATTLE_EVENT_DELETE,
|
||||
HISTORYTYPEDETAIL.BATTLE_EVENT_DELETE.name(),
|
||||
doc
|
||||
);
|
||||
|
||||
return new DynamodbOperationResult(true, "", doc);
|
||||
}
|
||||
return new DynamodbOperationResult(true, "null", doc);
|
||||
@@ -235,12 +220,6 @@ public class BattleEventRepositoryImpl extends BaseDynamoDBRepository<BattleEven
|
||||
|
||||
log.info("BattleEventDoc Update Stop Success: {}", objectMapper.writeValueAsString(afterDoc));
|
||||
|
||||
dynamodbHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPEDETAIL.BATTLE_EVENT_UPDATE,
|
||||
HISTORYTYPEDETAIL.BATTLE_EVENT_UPDATE.name(),
|
||||
beforeDoc,
|
||||
afterDoc
|
||||
);
|
||||
}
|
||||
}catch (Exception e){
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.caliverse.admin.dynamodb.repository.Impl;
|
||||
|
||||
import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
|
||||
import com.caliverse.admin.domain.request.LandRequest;
|
||||
import com.caliverse.admin.dynamodb.domain.atrrib.BuildingAttrib;
|
||||
import com.caliverse.admin.dynamodb.domain.doc.BuildingDoc;
|
||||
@@ -85,14 +84,8 @@ public class BuildingRepositoryImpl extends BaseDynamoDBRepository<BuildingDoc>
|
||||
|
||||
log.info("BuildingDoc Insert Success: {}", objectMapper.writeValueAsString(doc));
|
||||
|
||||
dynamodbHistoryLogService.insertHistoryLog(
|
||||
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_ADD,
|
||||
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_ADD.name(),
|
||||
doc
|
||||
);
|
||||
|
||||
}catch (Exception e){
|
||||
log.error("insert Error: {}", e.getMessage());
|
||||
log.error("insert info: {}, Error: {}", CommonUtils.objectByString(landRequest), e.getMessage());
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
||||
}
|
||||
}
|
||||
@@ -126,14 +119,9 @@ public class BuildingRepositoryImpl extends BaseDynamoDBRepository<BuildingDoc>
|
||||
|
||||
log.info("BuildingDoc Update Success: {}", objectMapper.writeValueAsString(afterDoc));
|
||||
|
||||
dynamodbHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_UPDATE,
|
||||
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_UPDATE.name(),
|
||||
beforeDoc,
|
||||
afterDoc
|
||||
);
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("update info: {}, Error: {}", CommonUtils.objectByString(landRequest), e.getMessage());
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
||||
}
|
||||
}
|
||||
@@ -162,12 +150,6 @@ public class BuildingRepositoryImpl extends BaseDynamoDBRepository<BuildingDoc>
|
||||
|
||||
log.info("BuildingDoc Owned Init Update Success: {}", objectMapper.writeValueAsString(afterDoc));
|
||||
|
||||
dynamodbHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPEDETAIL.LAND_OWNED_INITIALIZE,
|
||||
HISTORYTYPEDETAIL.LAND_OWNED_INITIALIZE.name(),
|
||||
beforeDoc,
|
||||
afterDoc
|
||||
);
|
||||
return new DynamodbOperationResult(true, "", afterDoc);
|
||||
}
|
||||
return new DynamodbOperationResult(false, "null", null);
|
||||
@@ -205,12 +187,6 @@ public class BuildingRepositoryImpl extends BaseDynamoDBRepository<BuildingDoc>
|
||||
|
||||
log.info("BuildingDoc Desc Init Update Success: {}", objectMapper.writeValueAsString(afterDoc));
|
||||
|
||||
dynamodbHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPEDETAIL.LAND_DESC_INITIALIZE,
|
||||
HISTORYTYPEDETAIL.LAND_DESC_INITIALIZE.name(),
|
||||
beforeDoc,
|
||||
afterDoc
|
||||
);
|
||||
return new DynamodbOperationResult(true, "Success", afterDoc);
|
||||
}
|
||||
return new DynamodbOperationResult(true, "null", beforeDoc);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.caliverse.admin.dynamodb.repository.Impl;
|
||||
|
||||
import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
|
||||
import com.caliverse.admin.dynamodb.domain.atrrib.CaliumStorageAttrib;
|
||||
import com.caliverse.admin.dynamodb.domain.doc.CaliumStorageDoc;
|
||||
import com.caliverse.admin.dynamodb.repository.BaseDynamoDBRepository;
|
||||
@@ -82,12 +81,6 @@ public class CaliumStorageRepositoryImpl extends BaseDynamoDBRepository<CaliumSt
|
||||
|
||||
log.info("CaliumStorageDoc Calium Total Update Success: {}", objectMapper.writeValueAsString(afterDoc));
|
||||
|
||||
dynamodbHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPEDETAIL.CALIUM_TOTAL_UPDATE,
|
||||
HISTORYTYPEDETAIL.CALIUM_TOTAL_UPDATE.name(),
|
||||
beforeDoc,
|
||||
afterDoc
|
||||
);
|
||||
}
|
||||
}catch (Exception e){
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
||||
@@ -130,12 +123,6 @@ public class CaliumStorageRepositoryImpl extends BaseDynamoDBRepository<CaliumSt
|
||||
|
||||
log.info("CaliumStorageDoc Calium Total Update Success: {}", objectMapper.writeValueAsString(afterDoc));
|
||||
|
||||
dynamodbHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPEDETAIL.CALIUM_TOTAL_UPDATE,
|
||||
HISTORYTYPEDETAIL.CALIUM_TOTAL_UPDATE.name(),
|
||||
beforeDoc,
|
||||
afterDoc
|
||||
);
|
||||
}
|
||||
}catch (Exception e){
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.caliverse.admin.dynamodb.repository.Impl;
|
||||
|
||||
import com.caliverse.admin.domain.entity.EFilterOperator;
|
||||
import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
|
||||
import com.caliverse.admin.dynamodb.domain.atrrib.ItemAttrib;
|
||||
import com.caliverse.admin.dynamodb.domain.doc.ItemDoc;
|
||||
import com.caliverse.admin.dynamodb.dto.PageResult;
|
||||
@@ -78,12 +77,6 @@ public class ItemRepositoryImpl extends BaseDynamoDBRepository<ItemDoc> implemen
|
||||
|
||||
log.info("updateItemStack Update Success: {}", CommonUtils.objectByString(afterDoc));
|
||||
|
||||
dynamodbHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPEDETAIL.ITEM_UPDATE,
|
||||
HISTORYTYPEDETAIL.ITEM_UPDATE.name(),
|
||||
beforeDoc,
|
||||
afterDoc
|
||||
);
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("Update Item Error: {}", e.getMessage());
|
||||
@@ -106,11 +99,6 @@ public class ItemRepositoryImpl extends BaseDynamoDBRepository<ItemDoc> implemen
|
||||
|
||||
log.info("ItemDoc Delete Success: {}", CommonUtils.objectByString(beforeDoc));
|
||||
|
||||
dynamodbHistoryLogService.deleteHistoryLog(
|
||||
HISTORYTYPEDETAIL.ITEM_DELETE,
|
||||
HISTORYTYPEDETAIL.ITEM_DELETE.name(),
|
||||
beforeDoc
|
||||
);
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("Update LandAuctionRegistry Error: {}", e.getMessage());
|
||||
|
||||
@@ -72,12 +72,6 @@ public class LandAuctionActivityRepositoryImpl extends BaseDynamoDBRepository<La
|
||||
|
||||
log.info("LandAuctionActivityDoc Delete Success: {}", objectMapper.writeValueAsString(doc));
|
||||
|
||||
dynamodbHistoryLogService.deleteHistoryLog(
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_INITIALIZE,
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_INITIALIZE.name(),
|
||||
doc
|
||||
);
|
||||
|
||||
return new DynamodbOperationResult(true, "delete success", doc);
|
||||
}
|
||||
return new DynamodbOperationResult(true, "null", doc);
|
||||
@@ -107,11 +101,6 @@ public class LandAuctionActivityRepositoryImpl extends BaseDynamoDBRepository<La
|
||||
|
||||
log.info("LandAuctionActivityDoc Insert Success: {}", objectMapper.writeValueAsString(activityDoc));
|
||||
|
||||
dynamodbHistoryLogService.insertHistoryLog(
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_ADD,
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_ADD.name(),
|
||||
activityDoc
|
||||
);
|
||||
}catch (Exception e){
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
||||
}
|
||||
@@ -131,12 +120,6 @@ public class LandAuctionActivityRepositoryImpl extends BaseDynamoDBRepository<La
|
||||
|
||||
log.info("LandAuctionActivityDoc Update Success: {}", objectMapper.writeValueAsString(afterDoc));
|
||||
|
||||
dynamodbHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_ADD,
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_ADD.name(),
|
||||
existingDoc,
|
||||
afterDoc
|
||||
);
|
||||
}catch (Exception e){
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
||||
}
|
||||
|
||||
@@ -70,12 +70,6 @@ public class LandAuctionHighestBidUserRepositoryImpl extends BaseDynamoDBReposit
|
||||
|
||||
log.info("LandAuctionRegistryDoc Insert Success: {}", objectMapper.writeValueAsString(registry));
|
||||
|
||||
dynamodbHistoryLogService.insertHistoryLog(
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_ADD,
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_ADD.name(),
|
||||
registry
|
||||
);
|
||||
|
||||
save(registry);
|
||||
}catch (Exception e){
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
||||
@@ -98,11 +92,6 @@ public class LandAuctionHighestBidUserRepositoryImpl extends BaseDynamoDBReposit
|
||||
|
||||
log.info("LandAuctionHighestBidUserDoc Delete Success: {}", objectMapper.writeValueAsString(doc));
|
||||
|
||||
dynamodbHistoryLogService.deleteHistoryLog(
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_INITIALIZE,
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_INITIALIZE.name(),
|
||||
doc
|
||||
);
|
||||
return new DynamodbOperationResult(true, "delete success", doc);
|
||||
}
|
||||
return new DynamodbOperationResult(true, "null", doc);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.caliverse.admin.dynamodb.repository.Impl;
|
||||
|
||||
import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
|
||||
import com.caliverse.admin.dynamodb.domain.doc.LandAuctionRecordDoc;
|
||||
import com.caliverse.admin.dynamodb.entity.DynamodbOperationResult;
|
||||
import com.caliverse.admin.dynamodb.repository.BaseDynamoDBRepository;
|
||||
@@ -36,11 +35,6 @@ public class LandAuctionRecordRepositoryImpl extends BaseDynamoDBRepository<Land
|
||||
|
||||
log.info("LandAuctionRecordDoc Delete Success: {}", objectMapper.writeValueAsString(doc));
|
||||
|
||||
dynamodbHistoryLogService.deleteHistoryLog(
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_INITIALIZE,
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_INITIALIZE.name(),
|
||||
doc
|
||||
);
|
||||
return new DynamodbOperationResult(true, "delete success", doc);
|
||||
}
|
||||
return new DynamodbOperationResult(true, "null", doc);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.caliverse.admin.dynamodb.repository.Impl;
|
||||
|
||||
import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
|
||||
import com.caliverse.admin.dynamodb.domain.doc.LandAuctionRefundBidPriceDoc;
|
||||
import com.caliverse.admin.dynamodb.entity.DynamodbOperationResult;
|
||||
import com.caliverse.admin.dynamodb.repository.BaseDynamoDBRepository;
|
||||
@@ -38,11 +37,6 @@ public class LandAuctionRefundBidPriceRepositoryImpl extends BaseDynamoDBReposit
|
||||
|
||||
log.info("LandAuctionRefundBidPriceDoc Delete Success: {}", objectMapper.writeValueAsString(doc));
|
||||
|
||||
dynamodbHistoryLogService.deleteHistoryLog(
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_INITIALIZE,
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_INITIALIZE.name(),
|
||||
doc
|
||||
);
|
||||
return new DynamodbOperationResult(true, "delete success", doc);
|
||||
}
|
||||
return new DynamodbOperationResult(true, "null", doc);
|
||||
|
||||
@@ -95,12 +95,6 @@ public class LandAuctionRegistryRepositoryImpl extends BaseDynamoDBRepository<La
|
||||
|
||||
log.info("LandAuctionRegistryDoc Insert Success: {}", objectMapper.writeValueAsString(registry));
|
||||
|
||||
dynamodbHistoryLogService.insertHistoryLog(
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_ADD,
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_ADD.name(),
|
||||
registry
|
||||
);
|
||||
|
||||
}catch (Exception e){
|
||||
log.error("Insert LandAuctionRegistry Error: {}", e.getMessage());
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
||||
@@ -134,12 +128,6 @@ public class LandAuctionRegistryRepositoryImpl extends BaseDynamoDBRepository<La
|
||||
|
||||
log.info("LandAuctionRegistryDoc Update Success: {}", objectMapper.writeValueAsString(afterDoc));
|
||||
|
||||
dynamodbHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_UPDATE,
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_UPDATE.name(),
|
||||
beforeDoc,
|
||||
afterDoc
|
||||
);
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("Update LandAuctionRegistry Error: {}", e.getMessage());
|
||||
@@ -172,12 +160,6 @@ public class LandAuctionRegistryRepositoryImpl extends BaseDynamoDBRepository<La
|
||||
|
||||
log.info("LandAuctionRegistryDoc Update Success: {}", objectMapper.writeValueAsString(afterDoc));
|
||||
|
||||
dynamodbHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_UPDATE,
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_UPDATE.name(),
|
||||
beforeDoc,
|
||||
afterDoc
|
||||
);
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("Cancel LandAuctionRegistry Error: {}", e.getMessage());
|
||||
@@ -204,12 +186,6 @@ public class LandAuctionRegistryRepositoryImpl extends BaseDynamoDBRepository<La
|
||||
|
||||
log.info("LandAuctionRegistryDoc Delete Success: {}", objectMapper.writeValueAsString(doc));
|
||||
|
||||
dynamodbHistoryLogService.deleteHistoryLog(
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_INITIALIZE,
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_INITIALIZE.name(),
|
||||
doc
|
||||
);
|
||||
|
||||
return new DynamodbOperationResult(true, "", doc);
|
||||
}
|
||||
return new DynamodbOperationResult(true, "null", doc);
|
||||
|
||||
@@ -80,12 +80,6 @@ public class LandRepositoryImpl extends BaseDynamoDBRepository<LandDoc> implemen
|
||||
|
||||
log.info("LandDoc Insert Success: {}", objectMapper.writeValueAsString(doc));
|
||||
|
||||
dynamodbHistoryLogService.insertHistoryLog(
|
||||
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_ADD,
|
||||
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_ADD.name(),
|
||||
doc
|
||||
);
|
||||
|
||||
}catch (Exception e){
|
||||
log.error("insertLand Error: {}", e.getMessage());
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
||||
@@ -120,13 +114,6 @@ public class LandRepositoryImpl extends BaseDynamoDBRepository<LandDoc> implemen
|
||||
update(afterDoc);
|
||||
|
||||
log.info("LandDoc Update Success: {}", objectMapper.writeValueAsString(afterDoc));
|
||||
|
||||
dynamodbHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_UPDATE,
|
||||
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_UPDATE.name(),
|
||||
beforeDoc,
|
||||
afterDoc
|
||||
);
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("updateLand Error: {}", e.getMessage());
|
||||
@@ -159,13 +146,6 @@ public class LandRepositoryImpl extends BaseDynamoDBRepository<LandDoc> implemen
|
||||
|
||||
log.info("LandDoc Owned Init Update Success: {}", objectMapper.writeValueAsString(afterDoc));
|
||||
|
||||
dynamodbHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPEDETAIL.LAND_OWNED_INITIALIZE,
|
||||
HISTORYTYPEDETAIL.LAND_OWNED_INITIALIZE.name(),
|
||||
beforeDoc,
|
||||
afterDoc
|
||||
);
|
||||
|
||||
return new DynamodbOperationResult(true, "",afterDoc);
|
||||
}
|
||||
return new DynamodbOperationResult(false, "null",null);
|
||||
@@ -200,12 +180,6 @@ public class LandRepositoryImpl extends BaseDynamoDBRepository<LandDoc> implemen
|
||||
|
||||
log.info("LandDoc Desc Init Update Success: {}", objectMapper.writeValueAsString(afterDoc));
|
||||
|
||||
dynamodbHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPEDETAIL.LAND_DESC_INITIALIZE,
|
||||
HISTORYTYPEDETAIL.LAND_DESC_INITIALIZE.name(),
|
||||
beforeDoc,
|
||||
afterDoc
|
||||
);
|
||||
return new DynamodbOperationResult(true, "Success",afterDoc);
|
||||
}
|
||||
return new DynamodbOperationResult(false, "null",beforeDoc);
|
||||
|
||||
@@ -81,12 +81,6 @@ public class MailJsonRepositoryImpl extends BaseDynamoDBRepository<MailJsonDoc>
|
||||
|
||||
log.info("MailDoc Recv Insert Success: {}", objectMapper.writeValueAsString(doc));
|
||||
|
||||
dynamodbHistoryLogService.insertHistoryLog(
|
||||
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_MAIL,
|
||||
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_MAIL.name(),
|
||||
doc
|
||||
);
|
||||
|
||||
}catch (Exception e){
|
||||
log.error("insert Error: {}", e.getMessage());
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
||||
@@ -144,12 +138,6 @@ public class MailJsonRepositoryImpl extends BaseDynamoDBRepository<MailJsonDoc>
|
||||
delete(key);
|
||||
|
||||
log.info("MailJsonDoc Delete Success: {}", objectMapper.writeValueAsString(beforeDoc));
|
||||
|
||||
dynamodbHistoryLogService.deleteHistoryLog(
|
||||
HISTORYTYPEDETAIL.MAIL_DELETE,
|
||||
HISTORYTYPEDETAIL.MAIL_DELETE.name(),
|
||||
beforeDoc
|
||||
);
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("Delete Mail Error: {}", e.getMessage());
|
||||
@@ -189,13 +177,6 @@ public class MailJsonRepositoryImpl extends BaseDynamoDBRepository<MailJsonDoc>
|
||||
update(afterDoc);
|
||||
|
||||
log.info("MailJsonDoc Item Update Success: {}", objectMapper.writeValueAsString(beforeDoc));
|
||||
|
||||
dynamodbHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPEDETAIL.MAIL_ITEM_DELETE,
|
||||
HISTORYTYPEDETAIL.MAIL_ITEM_DELETE.name(),
|
||||
beforeDoc,
|
||||
afterDoc
|
||||
);
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("Update Mail Item Error: {}", e.getMessage());
|
||||
|
||||
@@ -82,12 +82,6 @@ public class MailRepositoryImpl extends BaseDynamoDBRepository<MailDoc> implemen
|
||||
|
||||
log.info("MailDoc Recv Insert Success: {}", objectMapper.writeValueAsString(doc));
|
||||
|
||||
dynamodbHistoryLogService.insertHistoryLog(
|
||||
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_MAIL,
|
||||
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_MAIL.name(),
|
||||
doc
|
||||
);
|
||||
|
||||
}catch (Exception e){
|
||||
log.error("RECV Mail Insert Error: {}", e.getMessage());
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_PROCESS_ERROR.getMessage());
|
||||
@@ -146,11 +140,6 @@ public class MailRepositoryImpl extends BaseDynamoDBRepository<MailDoc> implemen
|
||||
|
||||
log.info("MailDoc Delete Success: {}", objectMapper.writeValueAsString(beforeDoc));
|
||||
|
||||
dynamodbHistoryLogService.deleteHistoryLog(
|
||||
HISTORYTYPEDETAIL.MAIL_DELETE,
|
||||
HISTORYTYPEDETAIL.MAIL_DELETE.name(),
|
||||
beforeDoc
|
||||
);
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("Delete Mail Error: {}", e.getMessage());
|
||||
@@ -191,12 +180,6 @@ public class MailRepositoryImpl extends BaseDynamoDBRepository<MailDoc> implemen
|
||||
|
||||
log.info("MailDoc Item Update Success: {}", objectMapper.writeValueAsString(beforeDoc));
|
||||
|
||||
dynamodbHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPEDETAIL.MAIL_ITEM_DELETE,
|
||||
HISTORYTYPEDETAIL.MAIL_ITEM_DELETE.name(),
|
||||
beforeDoc,
|
||||
afterDoc
|
||||
);
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("Update Mail Item Error: {}", e.getMessage());
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.caliverse.admin.dynamodb.repository.Impl;
|
||||
|
||||
import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
|
||||
import com.caliverse.admin.dynamodb.domain.atrrib.NicknameAttrib;
|
||||
import com.caliverse.admin.dynamodb.domain.doc.NicknameDoc;
|
||||
import com.caliverse.admin.dynamodb.repository.BaseDynamoDBRepository;
|
||||
@@ -68,12 +67,6 @@ public class NicknameRepositoryImpl extends BaseDynamoDBRepository<NicknameDoc>
|
||||
|
||||
log.info("NicknameDoc Update Success: {}", objectMapper.writeValueAsString(afterDoc));
|
||||
|
||||
dynamodbHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPEDETAIL.NICKNAME_UPDATE,
|
||||
HISTORYTYPEDETAIL.NICKNAME_UPDATE.name(),
|
||||
beforeDoc,
|
||||
afterDoc
|
||||
);
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("Update Nickname Error: {}", e.getMessage());
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.caliverse.admin.dynamodb.repository.Impl;
|
||||
|
||||
import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
|
||||
import com.caliverse.admin.dynamodb.domain.atrrib.OwnedBuildingAttrib;
|
||||
import com.caliverse.admin.dynamodb.domain.doc.OwnedBuildingDoc;
|
||||
import com.caliverse.admin.dynamodb.entity.EOwnedType;
|
||||
@@ -71,12 +70,6 @@ public class OwnedBuildingRepositoryImpl extends BaseDynamoDBRepository<OwnedBui
|
||||
|
||||
log.info("OwnedBuildingDoc Insert Success: {}", objectMapper.writeValueAsString(doc));
|
||||
|
||||
dynamodbHistoryLogService.insertHistoryLog(
|
||||
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_ADD,
|
||||
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_ADD.name(),
|
||||
doc
|
||||
);
|
||||
|
||||
}catch (Exception e){
|
||||
log.error("insert Error: {}", e.getMessage());
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
||||
@@ -97,11 +90,6 @@ public class OwnedBuildingRepositoryImpl extends BaseDynamoDBRepository<OwnedBui
|
||||
|
||||
log.info("OwnedBuildingDoc Delete Success: {}", objectMapper.writeValueAsString(doc));
|
||||
|
||||
dynamodbHistoryLogService.deleteHistoryLog(
|
||||
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_UPDATE,
|
||||
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_UPDATE.name(),
|
||||
doc
|
||||
);
|
||||
}catch (Exception e){
|
||||
log.error("delete Error: {}", e.getMessage());
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
||||
@@ -122,12 +110,6 @@ public class OwnedBuildingRepositoryImpl extends BaseDynamoDBRepository<OwnedBui
|
||||
|
||||
log.info("OwnedBuildingDoc Delete Success: {}", objectMapper.writeValueAsString(doc));
|
||||
|
||||
dynamodbHistoryLogService.deleteHistoryLog(
|
||||
HISTORYTYPEDETAIL.LAND_OWNED_INITIALIZE,
|
||||
HISTORYTYPEDETAIL.LAND_OWNED_INITIALIZE.name(),
|
||||
doc
|
||||
);
|
||||
|
||||
return new DynamodbOperationResult(true, "", doc);
|
||||
}catch (Exception e){
|
||||
log.error("Init OwnedBuilding Error: {}", e.getMessage());
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.caliverse.admin.dynamodb.repository.Impl;
|
||||
|
||||
import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
|
||||
import com.caliverse.admin.dynamodb.domain.atrrib.OwnedLandAttrib;
|
||||
import com.caliverse.admin.dynamodb.domain.doc.OwnedLandDoc;
|
||||
import com.caliverse.admin.dynamodb.entity.EOwnedType;
|
||||
@@ -71,12 +70,6 @@ public class OwnedLandRepositoryImpl extends BaseDynamoDBRepository<OwnedLandDoc
|
||||
|
||||
log.info("OwnedLandDoc Insert Success: {}", objectMapper.writeValueAsString(doc));
|
||||
|
||||
dynamodbHistoryLogService.insertHistoryLog(
|
||||
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_ADD,
|
||||
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_ADD.name(),
|
||||
doc
|
||||
);
|
||||
|
||||
}catch (Exception e){
|
||||
log.error("insert Error: {}", e.getMessage());
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
||||
@@ -97,11 +90,6 @@ public class OwnedLandRepositoryImpl extends BaseDynamoDBRepository<OwnedLandDoc
|
||||
|
||||
log.info("OwnedLandDoc Delete Success: {}", objectMapper.writeValueAsString(doc));
|
||||
|
||||
dynamodbHistoryLogService.deleteHistoryLog(
|
||||
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_UPDATE,
|
||||
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_UPDATE.name(),
|
||||
doc
|
||||
);
|
||||
}catch (Exception e){
|
||||
log.error("delete Error: {}", e.getMessage());
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
||||
@@ -122,11 +110,6 @@ public class OwnedLandRepositoryImpl extends BaseDynamoDBRepository<OwnedLandDoc
|
||||
|
||||
log.info("OwnedLandDoc Delete Success: {}", objectMapper.writeValueAsString(doc));
|
||||
|
||||
dynamodbHistoryLogService.deleteHistoryLog(
|
||||
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_UPDATE,
|
||||
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_UPDATE.name(),
|
||||
doc
|
||||
);
|
||||
return new DynamodbOperationResult(true, "", doc);
|
||||
}catch (Exception e){
|
||||
log.error("Init OwnedLand Error: {}", e.getMessage());
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.caliverse.admin.dynamodb.repository.Impl;
|
||||
|
||||
import com.caliverse.admin.domain.entity.EFilterOperator;
|
||||
import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
|
||||
import com.caliverse.admin.dynamodb.domain.atrrib.QuestAttrib;
|
||||
import com.caliverse.admin.dynamodb.domain.doc.QuestDoc;
|
||||
import com.caliverse.admin.dynamodb.dto.PageResult;
|
||||
@@ -68,12 +67,6 @@ public class QuestRepositoryImpl extends BaseDynamoDBRepository<QuestDoc> implem
|
||||
|
||||
log.info("updateQuest Update Success: {}", CommonUtils.objectByString(afterDoc));
|
||||
|
||||
dynamodbHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPEDETAIL.QUEST_UPDATE,
|
||||
HISTORYTYPEDETAIL.QUEST_UPDATE.name(),
|
||||
beforeDoc,
|
||||
afterDoc
|
||||
);
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("Update Quest Error: {}", e.getMessage());
|
||||
@@ -96,11 +89,6 @@ public class QuestRepositoryImpl extends BaseDynamoDBRepository<QuestDoc> implem
|
||||
|
||||
log.info("QuestDoc Delete Success: {}", CommonUtils.objectByString(beforeDoc));
|
||||
|
||||
dynamodbHistoryLogService.deleteHistoryLog(
|
||||
HISTORYTYPEDETAIL.QUEST_DELETE,
|
||||
HISTORYTYPEDETAIL.QUEST_DELETE.name(),
|
||||
beforeDoc
|
||||
);
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("Update QuestRegistry Error: {}", e.getMessage());
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
package com.caliverse.admin.dynamodb.repository.Impl;
|
||||
|
||||
import com.caliverse.admin.domain.entity.Event;
|
||||
import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
|
||||
import com.caliverse.admin.domain.entity.Message;
|
||||
import com.caliverse.admin.dynamodb.domain.atrrib.SystemMetaMailAttrib;
|
||||
import com.caliverse.admin.dynamodb.domain.doc.LandAuctionRegistryDoc;
|
||||
import com.caliverse.admin.dynamodb.domain.doc.SystemMetaMailDoc;
|
||||
import com.caliverse.admin.dynamodb.entity.DynamodbOperationResult;
|
||||
import com.caliverse.admin.dynamodb.repository.BaseDynamoDBRepository;
|
||||
@@ -61,12 +59,6 @@ public class SystemMetaMailRepositoryImpl extends BaseDynamoDBRepository<SystemM
|
||||
|
||||
save(doc);
|
||||
|
||||
dynamodbHistoryLogService.insertHistoryLog(
|
||||
HISTORYTYPEDETAIL.EVENT_ADD,
|
||||
HISTORYTYPEDETAIL.EVENT_ADD.name(),
|
||||
doc
|
||||
);
|
||||
|
||||
}catch (Exception e){
|
||||
log.error("insert Error: {}", e.getMessage());
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
||||
@@ -92,12 +84,6 @@ public class SystemMetaMailRepositoryImpl extends BaseDynamoDBRepository<SystemM
|
||||
|
||||
log.info("SystemMetaMailDoc Delete Success: {}", objectMapper.writeValueAsString(doc));
|
||||
|
||||
dynamodbHistoryLogService.deleteHistoryLog(
|
||||
HISTORYTYPEDETAIL.SYSTEM_META_MAIL_DELETE,
|
||||
HISTORYTYPEDETAIL.SYSTEM_META_MAIL_DELETE.name(),
|
||||
doc
|
||||
);
|
||||
|
||||
return new DynamodbOperationResult(true, "", doc);
|
||||
}
|
||||
return new DynamodbOperationResult(true, "null", doc);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.caliverse.admin.dynamodb.repository.Impl;
|
||||
|
||||
import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
|
||||
import com.caliverse.admin.dynamodb.domain.atrrib.UserNicknameRegistryAttrib;
|
||||
import com.caliverse.admin.dynamodb.domain.doc.UserNicknameRegistryDoc;
|
||||
import com.caliverse.admin.dynamodb.repository.BaseDynamoDBRepository;
|
||||
@@ -106,11 +105,6 @@ public class UserNicknameRegistryRepositoryImpl extends BaseDynamoDBRepository<U
|
||||
|
||||
log.info("UserNicknameRegistryDoc Delete Success: {}", objectMapper.writeValueAsString(beforeDoc));
|
||||
|
||||
dynamodbHistoryLogService.deleteHistoryLog(
|
||||
HISTORYTYPEDETAIL.NICKNAME_REGISTRY_DELETE,
|
||||
HISTORYTYPEDETAIL.NICKNAME_REGISTRY_DELETE.name(),
|
||||
beforeDoc
|
||||
);
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("Delete UserNicknameRegistry Error: {}", e.getMessage());
|
||||
@@ -138,11 +132,6 @@ public class UserNicknameRegistryRepositoryImpl extends BaseDynamoDBRepository<U
|
||||
|
||||
log.info("UserNicknameRegistryDoc Insert Success: {}", objectMapper.writeValueAsString(afterDoc));
|
||||
|
||||
dynamodbHistoryLogService.insertHistoryLog(
|
||||
HISTORYTYPEDETAIL.NICKNAME_REGISTRY_ADD,
|
||||
HISTORYTYPEDETAIL.NICKNAME_REGISTRY_ADD.name(),
|
||||
afterDoc
|
||||
);
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("Insert UserNicknameRegistry Error: {}", e.getMessage());
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.caliverse.admin.dynamodb.service;
|
||||
import com.caliverse.admin.domain.entity.EFilterOperator;
|
||||
import com.caliverse.admin.dynamodb.dto.PageResult;
|
||||
import com.caliverse.admin.global.common.constants.CommonConstants;
|
||||
import com.caliverse.admin.global.component.transaction.DynamoDBTransactionContext;
|
||||
import com.caliverse.admin.global.component.manager.DynamoDBTransactionContext;
|
||||
import com.caliverse.admin.global.common.code.CommonCode;
|
||||
import com.caliverse.admin.global.common.exception.RestApiException;
|
||||
import com.caliverse.admin.global.common.code.ErrorCode;
|
||||
|
||||
@@ -8,7 +8,7 @@ import com.caliverse.admin.dynamodb.domain.atrrib.LandAuctionRegistryAttrib;
|
||||
import com.caliverse.admin.dynamodb.domain.doc.LandAuctionRegistryDoc;
|
||||
import com.caliverse.admin.dynamodb.repository.*;
|
||||
import com.caliverse.admin.global.common.constants.DynamoDBConstants;
|
||||
import com.caliverse.admin.global.component.transaction.TransactionIdManager;
|
||||
import com.caliverse.admin.global.component.manager.TransactionIdManager;
|
||||
import com.caliverse.admin.mongodb.service.DataInitializeHistoryService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@@ -13,7 +13,7 @@ import com.caliverse.admin.global.common.annotation.DynamoDBTransaction;
|
||||
import com.caliverse.admin.dynamodb.domain.atrrib.LandAuctionHighestBidUserAttrib;
|
||||
import com.caliverse.admin.dynamodb.domain.atrrib.LandAuctionRegistryAttrib;
|
||||
import com.caliverse.admin.global.common.constants.DynamoDBConstants;
|
||||
import com.caliverse.admin.global.component.transaction.TransactionIdManager;
|
||||
import com.caliverse.admin.global.component.manager.TransactionIdManager;
|
||||
import com.caliverse.admin.mongodb.service.DataInitializeHistoryService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@@ -14,7 +14,7 @@ import com.caliverse.admin.dynamodb.repository.OwnedBuildingRepository;
|
||||
import com.caliverse.admin.dynamodb.repository.OwnedLandRepository;
|
||||
import com.caliverse.admin.global.common.annotation.DynamoDBTransaction;
|
||||
import com.caliverse.admin.global.common.constants.DynamoDBConstants;
|
||||
import com.caliverse.admin.global.component.transaction.TransactionIdManager;
|
||||
import com.caliverse.admin.global.component.manager.TransactionIdManager;
|
||||
import com.caliverse.admin.mongodb.service.DataInitializeHistoryService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.caliverse.admin.global.common.annotation;
|
||||
|
||||
import com.caliverse.admin.domain.entity.log.LogAction;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Target(ElementType.METHOD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface BusinessProcess {
|
||||
LogAction action() default LogAction.UNKNOWN;
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.caliverse.admin.global.common.aspect;
|
||||
|
||||
import com.caliverse.admin.domain.entity.log.LogAction;
|
||||
import com.caliverse.admin.global.common.annotation.BusinessProcess;
|
||||
import com.caliverse.admin.global.component.manager.BusinessProcessIdManager;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Aspect
|
||||
@Component
|
||||
@Slf4j
|
||||
public class BusinessProcessAspect {
|
||||
private final BusinessProcessIdManager processIdManager;
|
||||
|
||||
public BusinessProcessAspect(BusinessProcessIdManager processIdManager) {
|
||||
this.processIdManager = processIdManager;
|
||||
}
|
||||
|
||||
@Around("@annotation(businessProcess)")
|
||||
public Object handleBusinessProcess(ProceedingJoinPoint joinPoint, BusinessProcess businessProcess) throws Throwable {
|
||||
|
||||
// 이미 프로세스 ID가 있는 경우 (하위 메서드) - 그대로 진행
|
||||
if (processIdManager.hasProcessId()) {
|
||||
return joinPoint.proceed();
|
||||
}
|
||||
|
||||
// 새로운 프로세스 시작
|
||||
String processId = processIdManager.createNewProcessId();
|
||||
String processName = joinPoint.getSignature().getName();
|
||||
|
||||
LogAction businessAction = businessProcess.action();
|
||||
if (businessAction == LogAction.UNKNOWN) {
|
||||
log.warn("Unknown business action: {}", processName);
|
||||
}
|
||||
processIdManager.setCurrentAction(businessAction);
|
||||
|
||||
log.debug("Business process started: {} (ID: {})", processName, processId);
|
||||
|
||||
try {
|
||||
Object result = joinPoint.proceed();
|
||||
log.debug("Business process completed: {} (ID: {})", processName, processId);
|
||||
return result;
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("Business process failed: {} (ID: {}), Error: {}", processName, processId, e.getMessage());
|
||||
throw e;
|
||||
|
||||
} finally {
|
||||
// 프로세스 종료 시 clear
|
||||
processIdManager.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,8 +3,8 @@ package com.caliverse.admin.global.common.aspect;
|
||||
import com.caliverse.admin.global.common.code.CommonCode;
|
||||
import com.caliverse.admin.global.common.code.ErrorCode;
|
||||
import com.caliverse.admin.global.common.exception.RestApiException;
|
||||
import com.caliverse.admin.global.component.transaction.DynamoDBTransactionContext;
|
||||
import com.caliverse.admin.global.component.transaction.TransactionIdManager;
|
||||
import com.caliverse.admin.global.component.manager.DynamoDBTransactionContext;
|
||||
import com.caliverse.admin.global.component.manager.TransactionIdManager;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.caliverse.admin.global.common.aspect;
|
||||
|
||||
import com.caliverse.admin.global.component.transaction.TransactionIdManager;
|
||||
import com.caliverse.admin.global.component.manager.TransactionIdManager;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
|
||||
@@ -13,4 +13,7 @@ public class MysqlConstants {
|
||||
public static String TABLE_NAME_BATTLE_EVENT = "battle_event";
|
||||
public static String TABLE_NAME_MESSAGE = "message";
|
||||
public static String TABLE_NAME_DATA_INIT = "data_initialize_schedule";
|
||||
public static String TABLE_NAME_GROUP = "groups";
|
||||
public static String TABLE_NAME_GROUP_AUTH = "group_auth";
|
||||
public static String TABLE_NAME_TOKEN = "token";
|
||||
}
|
||||
|
||||
@@ -53,6 +53,7 @@ public class FileUtils {
|
||||
return Files.readAllBytes(sourcePath);
|
||||
|
||||
} catch (IOException e) {
|
||||
log.error(e.getMessage());
|
||||
throw new RuntimeException("파일 로드 중 오류 발생: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
@@ -89,7 +90,8 @@ public class FileUtils {
|
||||
Files.copy(file.getInputStream(), destinationPath, StandardCopyOption.REPLACE_EXISTING);
|
||||
|
||||
return fileName;
|
||||
}catch (IOException e){
|
||||
} catch(Exception e){
|
||||
log.error(e.getMessage());
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.ERROR_FILE_UPLOAD.getMessage());
|
||||
}
|
||||
}
|
||||
@@ -105,6 +107,7 @@ public class FileUtils {
|
||||
|
||||
return Files.deleteIfExists(fileToDelete);
|
||||
} catch (IOException e) {
|
||||
log.error(e.getMessage());
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.ERROR_FILE_DELETE.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,138 @@
|
||||
package com.caliverse.admin.global.component;
|
||||
|
||||
import com.caliverse.admin.domain.entity.log.LogAction;
|
||||
import com.caliverse.admin.domain.entity.log.LogStatus;
|
||||
import com.caliverse.admin.global.common.constants.MysqlConstants;
|
||||
import com.caliverse.admin.global.component.manager.BeforeDataResolver;
|
||||
import com.caliverse.admin.global.component.manager.BusinessProcessIdManager;
|
||||
import com.caliverse.admin.mongodb.service.MysqlHistoryLogService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.ibatis.mapping.MappedStatement;
|
||||
import org.apache.ibatis.mapping.SqlCommandType;
|
||||
import org.apache.ibatis.plugin.Interceptor;
|
||||
import org.apache.ibatis.plugin.Intercepts;
|
||||
import org.apache.ibatis.plugin.Invocation;
|
||||
import org.apache.ibatis.plugin.Signature;
|
||||
import org.apache.ibatis.executor.Executor;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.support.TransactionSynchronization;
|
||||
import org.springframework.transaction.support.TransactionSynchronizationManager;
|
||||
|
||||
@Intercepts({
|
||||
@Signature(type = Executor.class, method = "update", args = {MappedStatement.class, Object.class})
|
||||
})
|
||||
@Component
|
||||
@Slf4j
|
||||
public class MysqlLoggingInterceptor implements Interceptor {
|
||||
private final BusinessProcessIdManager processIdManager;
|
||||
private final MysqlHistoryLogService mysqlHistoryLogService;
|
||||
private final BeforeDataResolver beforeDataResolver;
|
||||
|
||||
public MysqlLoggingInterceptor(MysqlHistoryLogService mysqlHistoryLogService, BusinessProcessIdManager processIdManager, BeforeDataResolver beforeDataResolver) {
|
||||
this.mysqlHistoryLogService = mysqlHistoryLogService;
|
||||
this.beforeDataResolver = beforeDataResolver;
|
||||
this.processIdManager = processIdManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object intercept(Invocation invocation) throws Throwable {
|
||||
MappedStatement mappedStatement = (MappedStatement) invocation.getArgs()[0];
|
||||
Object parameter = invocation.getArgs()[1];
|
||||
|
||||
String sqlId = mappedStatement.getId();
|
||||
SqlCommandType sqlCommandType = mappedStatement.getSqlCommandType();
|
||||
|
||||
if (!shouldLog(sqlId, sqlCommandType)) {
|
||||
return invocation.proceed();
|
||||
}
|
||||
if(sqlId.contains("Message")){
|
||||
return invocation.proceed();
|
||||
}
|
||||
|
||||
// Before 데이터 조회
|
||||
Object beforeData = null;
|
||||
if (sqlCommandType == SqlCommandType.UPDATE || sqlCommandType == SqlCommandType.DELETE) {
|
||||
beforeData = beforeDataResolver.resolveBeforeData(sqlId, parameter);
|
||||
}
|
||||
|
||||
Object result = invocation.proceed();
|
||||
|
||||
// After 데이터 조회
|
||||
Object afterData = null;
|
||||
if (sqlCommandType == SqlCommandType.UPDATE || sqlCommandType == SqlCommandType.INSERT) {
|
||||
afterData = beforeDataResolver.resolveBeforeData(sqlId, parameter);
|
||||
}
|
||||
|
||||
scheduleLoggingAfterTransaction(sqlId, sqlCommandType, beforeData, afterData);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private boolean shouldLog(String sqlId, SqlCommandType sqlCommandType) {
|
||||
return (sqlCommandType == SqlCommandType.INSERT ||
|
||||
sqlCommandType == SqlCommandType.UPDATE ||
|
||||
sqlCommandType == SqlCommandType.DELETE);
|
||||
}
|
||||
|
||||
private void scheduleLoggingAfterTransaction(String sqlId, SqlCommandType sqlCommandType,
|
||||
Object beforeData, Object result) {
|
||||
String processId = processIdManager.getCurrentProcessId();
|
||||
LogAction action = processIdManager.getCurrentAction();
|
||||
|
||||
if (!TransactionSynchronizationManager.isSynchronizationActive()) {
|
||||
logDatabaseOperation(sqlId, sqlCommandType, beforeData, result, processId, action);
|
||||
return;
|
||||
}
|
||||
|
||||
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
|
||||
@Override
|
||||
public void afterCommit() {
|
||||
try {
|
||||
logDatabaseOperation(sqlId, sqlCommandType, beforeData, result, processId, action);
|
||||
} catch (Exception e) {
|
||||
log.warn("Failed to log after transaction commit: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void logDatabaseOperation(String sqlId, SqlCommandType sqlCommandType,
|
||||
Object beforeData, Object result, String processId, LogAction action) {
|
||||
String tableName = extractTableName(sqlId);
|
||||
|
||||
if(beforeData == null && result == null) return;
|
||||
|
||||
// 로깅 수행
|
||||
switch (sqlCommandType) {
|
||||
case INSERT -> mysqlHistoryLogService.insertHistoryLog(
|
||||
processId, action, LogStatus.SUCCESS, tableName, "", result
|
||||
);
|
||||
case UPDATE -> mysqlHistoryLogService.updateHistoryLog(
|
||||
processId, action, LogStatus.SUCCESS, tableName, "", beforeData, result
|
||||
);
|
||||
case DELETE -> mysqlHistoryLogService.deleteHistoryLog(
|
||||
processId, action, LogStatus.SUCCESS, tableName, "", beforeData
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private String extractTableName(String sqlId) {
|
||||
// sqlId에서 테이블명 추출 로직
|
||||
if (sqlId.contains("Admin")) return MysqlConstants.TABLE_NAME_ADMIN;
|
||||
if (sqlId.contains("Banner") && sqlId.contains("Menu")) return MysqlConstants.TABLE_NAME_MENU_BANNER;
|
||||
if (sqlId.contains("BlackList")) return MysqlConstants.TABLE_NAME_USER_BLOCK;
|
||||
if (sqlId.contains("Calium")) return MysqlConstants.TABLE_NAME_CALIUM_REQUEST;
|
||||
if (sqlId.contains("Data")) return MysqlConstants.TABLE_NAME_DATA_INIT;
|
||||
if (sqlId.contains("Event")) return MysqlConstants.TABLE_NAME_EVENT;
|
||||
if (sqlId.contains("Battle")) return MysqlConstants.TABLE_NAME_BATTLE_EVENT;
|
||||
if (sqlId.contains("GroupAuth")) return MysqlConstants.TABLE_NAME_GROUP_AUTH;
|
||||
if (sqlId.contains("Group")) return MysqlConstants.TABLE_NAME_GROUP;
|
||||
if (sqlId.contains("Mail")) return MysqlConstants.TABLE_NAME_MAIL;
|
||||
if (sqlId.contains("Notice")) return MysqlConstants.TABLE_NAME_NOTICE;
|
||||
if (sqlId.contains("LandAuction")) return MysqlConstants.TABLE_NAME_LAND_AUCTION;
|
||||
if (sqlId.contains("LandOwner")) return MysqlConstants.TABLE_NAME_LAND_OWNER_CHANGE;
|
||||
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,381 @@
|
||||
package com.caliverse.admin.global.component.manager;
|
||||
|
||||
import com.caliverse.admin.domain.dao.admin.*;
|
||||
import com.caliverse.admin.domain.dao.total.WalletUserMapper;
|
||||
import com.caliverse.admin.domain.entity.*;
|
||||
import com.caliverse.admin.domain.request.*;
|
||||
import com.caliverse.admin.global.common.utils.CommonUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.function.BiFunction;
|
||||
import java.util.function.Function;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class BeforeDataResolver {
|
||||
private final AdminMapper adminMapper;
|
||||
private final MenuMapper menuMapper;
|
||||
private final LandMapper landMapper;
|
||||
private final BattleMapper battleMapper;
|
||||
private final BlackListMapper blackListMapper;
|
||||
private final CaliumMapper caliumMapper;
|
||||
private final EventMapper eventMapper;
|
||||
private final GroupMapper groupMapper;
|
||||
private final MailMapper mailMapper;
|
||||
private final NoticeMapper noticeMapper;
|
||||
private final DataMapper dataMapper;
|
||||
|
||||
public BeforeDataResolver(@Lazy AdminMapper adminMapper,
|
||||
@Lazy MenuMapper menuMapper,
|
||||
@Lazy LandMapper landMapper,
|
||||
@Lazy BattleMapper battleMapper,
|
||||
@Lazy BlackListMapper blackListMapper,
|
||||
@Lazy CaliumMapper caliumMapper,
|
||||
@Lazy EventMapper eventMapper,
|
||||
@Lazy GroupMapper groupMapper,
|
||||
@Lazy MailMapper mailMapper,
|
||||
@Lazy NoticeMapper noticeMapper,
|
||||
@Lazy DataMapper dataMapper
|
||||
) {
|
||||
this.adminMapper = adminMapper;
|
||||
this.menuMapper = menuMapper;
|
||||
this.landMapper = landMapper;
|
||||
this.battleMapper = battleMapper;
|
||||
this.blackListMapper = blackListMapper;
|
||||
this.caliumMapper = caliumMapper;
|
||||
this.eventMapper = eventMapper;
|
||||
this.groupMapper = groupMapper;
|
||||
this.mailMapper = mailMapper;
|
||||
this.noticeMapper = noticeMapper;
|
||||
this.dataMapper = dataMapper;
|
||||
}
|
||||
|
||||
private static final Map<String, Function<BeforeDataResolver, BiFunction<String, Object, Object>>> RESOLVER_MAP = Map.ofEntries(
|
||||
Map.entry("AdminMapper", resolver -> resolver::resolveAdminBeforeData),
|
||||
Map.entry("MenuMapper", resolver -> resolver::resolveBannerBeforeData),
|
||||
Map.entry("BattleMapper", resolver -> resolver::resolveBattleBeforeData),
|
||||
Map.entry("BlackListMapper", resolver -> resolver::resolveBlackListBeforeData),
|
||||
Map.entry("CaliumMapper", resolver -> resolver::resolveCaliumBeforeData),
|
||||
Map.entry("EventMapper", resolver -> resolver::resolveEventBeforeData),
|
||||
Map.entry("MailMapper", resolver -> resolver::resolveMailBeforeData),
|
||||
Map.entry("NoticeMapper", resolver -> resolver::resolveNoticeBeforeData),
|
||||
Map.entry("LandMapper", resolver -> resolver::resolveLandBeforeData),
|
||||
Map.entry("DataMapper", resolver -> resolver::resolveDataBeforeData),
|
||||
Map.entry("GroupMapper", resolver -> resolver::resolveGroupBeforeData)
|
||||
);
|
||||
|
||||
public Object resolveBeforeData(String sqlId, Object parameter) {
|
||||
try {
|
||||
return RESOLVER_MAP.entrySet().stream()
|
||||
.filter(entry -> sqlId.contains(entry.getKey()))
|
||||
.findFirst()
|
||||
.map(entry -> entry.getValue().apply(this).apply(sqlId, parameter))
|
||||
.orElse(null);
|
||||
|
||||
} catch (Exception e) {
|
||||
log.warn("Failed to resolve before data for {}: {}", sqlId, e.getMessage());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private Object resolveGroupBeforeData(String sqlId, Object parameter) {
|
||||
if(sqlId.contains("postGroup") || sqlId.contains("deleteGroup")){
|
||||
if (parameter instanceof Map) {
|
||||
Map<String, Object> params = (Map<String, Object>) parameter;
|
||||
|
||||
if (params.containsKey("groupId")) {
|
||||
return groupMapper.getGroupInfo(Long.parseLong((String) params.get("groupId")));
|
||||
}
|
||||
}
|
||||
|
||||
if (parameter instanceof GroupRequest params) {
|
||||
return groupMapper.getGroupInfo(params.getId());
|
||||
}
|
||||
|
||||
if(parameter instanceof Long id){
|
||||
return groupMapper.getGroupInfo(id);
|
||||
}
|
||||
}
|
||||
|
||||
if (parameter instanceof Map) {
|
||||
Map<String, Object> params = (Map<String, Object>) parameter;
|
||||
|
||||
if (params.containsKey("groupId")) {
|
||||
return groupMapper.getGroupAuth(Long.parseLong((String) params.get("groupId")));
|
||||
}
|
||||
}
|
||||
|
||||
if (parameter instanceof GroupRequest params) {
|
||||
return groupMapper.getGroupAuth(params.getId());
|
||||
}
|
||||
|
||||
if(parameter instanceof Long id){
|
||||
return groupMapper.getGroupAuth(id);
|
||||
}
|
||||
|
||||
if(parameter instanceof String id){
|
||||
return groupMapper.getGroupAuth(Long.parseLong(id));
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private Object resolveDataBeforeData(String sqlId, Object parameter) {
|
||||
if (parameter instanceof Map) {
|
||||
Map<String, Object> params = (Map<String, Object>) parameter;
|
||||
|
||||
if (params.containsKey("id")) {
|
||||
return dataMapper.getDataInitDetail((Long) params.get("id"));
|
||||
}
|
||||
}
|
||||
|
||||
if (parameter instanceof DataRequest params) {
|
||||
return dataMapper.getDataInitDetail(params.getId());
|
||||
}
|
||||
|
||||
if(parameter instanceof Long id){
|
||||
return dataMapper.getDataInitDetail(id);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private Object resolveLandBeforeData(String sqlId, Object parameter) {
|
||||
if (parameter instanceof Map) {
|
||||
Map<String, Object> params = (Map<String, Object>) parameter;
|
||||
|
||||
if (params.containsKey("id")) {
|
||||
if(sqlId.contains("LandOwnerChange")){
|
||||
return landMapper.getLandOwnerChangeDetail((Long) params.get("id"));
|
||||
}
|
||||
return landMapper.getLandAuctionDetail((Long) params.get("id"));
|
||||
}
|
||||
}
|
||||
|
||||
if (parameter instanceof LandRequest params) {
|
||||
if(sqlId.contains("LandOwnerChange")){
|
||||
return landMapper.getLandOwnerChangeDetail(params.getId());
|
||||
}
|
||||
return landMapper.getLandAuctionDetail(params.getId());
|
||||
}
|
||||
|
||||
if(parameter instanceof Long id){
|
||||
if(sqlId.contains("LandOwnerChange")){
|
||||
return landMapper.getLandOwnerChangeDetail(id);
|
||||
}
|
||||
return landMapper.getLandAuctionDetail(id);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private Object resolveAdminBeforeData(String sqlId, Object parameter) {
|
||||
|
||||
if(sqlId.contains("initPwd") || sqlId.contains("updatePwd")) {
|
||||
if (parameter instanceof AuthenticateRequest params) {
|
||||
String email = params.getEmail() == null ? CommonUtils.getAdmin().getEmail() : params.getEmail();
|
||||
return adminMapper.findByEmail(email).get();
|
||||
}
|
||||
if (parameter instanceof Map) {
|
||||
Map<String, Object> params = (Map<String, Object>) parameter;
|
||||
|
||||
if (params.containsKey("id")) {
|
||||
return adminMapper.findById((Long) params.get("id")).get();
|
||||
}
|
||||
Long id = CommonUtils.getAdmin().getId();
|
||||
if (id != null) {
|
||||
return adminMapper.findById(id).get();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(sqlId.contains("updateStatus") || sqlId.contains("updateGroup") || sqlId.contains("deleteAdmin")) {
|
||||
if (parameter instanceof AdminRequest params) {
|
||||
String email = params.getList().get(0).getEmail() == null ? CommonUtils.getAdmin().getEmail() : params.getList().get(0).getEmail();
|
||||
return adminMapper.findByEmail(email).get();
|
||||
}
|
||||
if (parameter instanceof Map) {
|
||||
Map<String, Object> params = (Map<String, Object>) parameter;
|
||||
|
||||
if (params.containsKey("email")) {
|
||||
return adminMapper.findByEmail((String) params.get("email")).get();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(sqlId.contains("save")){
|
||||
if(parameter instanceof Admin params){
|
||||
return adminMapper.findByEmail(params.getEmail()).get();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private Object resolveBannerBeforeData(String sqlId, Object parameter) {
|
||||
if (sqlId.contains("insertBanner")) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (parameter instanceof Map) {
|
||||
Map<String, Object> params = (Map<String, Object>) parameter;
|
||||
|
||||
if (params.containsKey("id")) {
|
||||
MenuBanner info = menuMapper.getBannerDetail((Long) params.get("id"));
|
||||
if(info != null){
|
||||
info.setImageList(menuMapper.getMessage((Long) params.get("id")));
|
||||
}
|
||||
return info;
|
||||
}
|
||||
}
|
||||
|
||||
if (parameter instanceof MenuRequest params) {
|
||||
MenuBanner info =menuMapper.getBannerDetail(params.getId());
|
||||
if(info != null) {
|
||||
info.setImageList(menuMapper.getMessage(params.getId()));
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private Object resolveBattleBeforeData(String sqlId, Object parameter) {
|
||||
if (parameter instanceof Map) {
|
||||
Map<String, Object> params = (Map<String, Object>) parameter;
|
||||
|
||||
if (params.containsKey("id")) {
|
||||
return battleMapper.getBattleEventDetail((Long) params.get("id"));
|
||||
}
|
||||
}
|
||||
|
||||
if (parameter instanceof BattleEventRequest params) {
|
||||
return battleMapper.getBattleEventDetail(params.getId());
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private Object resolveBlackListBeforeData(String sqlId, Object parameter) {
|
||||
if (parameter instanceof Map) {
|
||||
Map<String, Object> params = (Map<String, Object>) parameter;
|
||||
|
||||
if (params.containsKey("id")) {
|
||||
return blackListMapper.getBlackListDetail((Long) params.get("id"));
|
||||
}
|
||||
}
|
||||
|
||||
if (parameter instanceof BlackListRequest params) {
|
||||
return blackListMapper.getBlackListDetail(params.getId());
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private Object resolveCaliumBeforeData(String sqlId, Object parameter) {
|
||||
if (parameter instanceof Map) {
|
||||
Map<String, Object> params = (Map<String, Object>) parameter;
|
||||
|
||||
if (params.containsKey("id")) {
|
||||
return caliumMapper.getCaliumRequestDetail((Long) params.get("id"));
|
||||
}
|
||||
}
|
||||
|
||||
if (parameter instanceof CaliumRequest params) {
|
||||
return caliumMapper.getCaliumRequestDetail(params.getId());
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private Object resolveEventBeforeData(String sqlId, Object parameter) {
|
||||
if (sqlId.contains("postEvent") || sqlId.contains("updateEvent")) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (parameter instanceof Map) {
|
||||
Map<String, Object> params = (Map<String, Object>) parameter;
|
||||
|
||||
if (params.containsKey("id")) {
|
||||
Long id = (Long) params.get("id");
|
||||
Event event = eventMapper.getEventDetail(id);
|
||||
event.setMailList(eventMapper.getMessage(id));
|
||||
event.setItemList(eventMapper.getItem(id));
|
||||
return event;
|
||||
}
|
||||
}
|
||||
|
||||
if (parameter instanceof EventRequest params) {
|
||||
Long id = params.getId();
|
||||
Event event = eventMapper.getEventDetail(id);
|
||||
event.setMailList(eventMapper.getMessage(id));
|
||||
event.setItemList(eventMapper.getItem(id));
|
||||
return event;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private Object resolveMailBeforeData(String sqlId, Object parameter) {
|
||||
if (sqlId.contains("postMail") || sqlId.contains("updateMail")) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (parameter instanceof Map) {
|
||||
Map<String, Object> params = (Map<String, Object>) parameter;
|
||||
|
||||
if (params.containsKey("id")) {
|
||||
Long id = (Long) params.get("id");
|
||||
Mail mail = mailMapper.getMailDetail(id);
|
||||
mail.setMailList(mailMapper.getMessage(id));
|
||||
mail.setItemList(mailMapper.getItem(id));
|
||||
return mail;
|
||||
}
|
||||
}
|
||||
|
||||
if (parameter instanceof MailRequest params) {
|
||||
Long id = params.getId();
|
||||
Mail mail = mailMapper.getMailDetail(id);
|
||||
mail.setMailList(mailMapper.getMessage(id));
|
||||
mail.setItemList(mailMapper.getItem(id));
|
||||
return mail;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private Object resolveNoticeBeforeData(String sqlId, Object parameter) {
|
||||
if (sqlId.contains("postNotice") || sqlId.contains("updateNotice")) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (parameter instanceof Map) {
|
||||
Map<String, Object> params = (Map<String, Object>) parameter;
|
||||
|
||||
if (params.containsKey("id")) {
|
||||
Long id = (Long) params.get("id");
|
||||
InGame notice = noticeMapper.getNoticeDetail(id);
|
||||
notice.setMessageList(noticeMapper.getMessage(id));
|
||||
return notice;
|
||||
}
|
||||
}
|
||||
|
||||
if (parameter instanceof NoticeRequest params) {
|
||||
Long id = params.getId();
|
||||
InGame notice = noticeMapper.getNoticeDetail(id);
|
||||
notice.setMessageList(noticeMapper.getMessage(id));
|
||||
return notice;
|
||||
}
|
||||
|
||||
if(parameter instanceof Long id){
|
||||
InGame notice = noticeMapper.getNoticeDetail(id);
|
||||
notice.setMessageList(noticeMapper.getMessage(id));
|
||||
return notice;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.caliverse.admin.global.component.manager;
|
||||
|
||||
import com.caliverse.admin.domain.entity.log.LogAction;
|
||||
import com.caliverse.admin.global.common.utils.CommonUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class BusinessProcessIdManager {
|
||||
private static final ThreadLocal<String> processId = new ThreadLocal<>();
|
||||
private static final ThreadLocal<LogAction> businessAction = new ThreadLocal<>();
|
||||
|
||||
public String getCurrentProcessId() {
|
||||
return processId.get();
|
||||
}
|
||||
|
||||
public LogAction getCurrentAction() {
|
||||
return businessAction.get();
|
||||
}
|
||||
|
||||
public String createNewProcessId() {
|
||||
String newId = CommonUtils.getCreateGuId();
|
||||
processId.set(newId);
|
||||
return newId;
|
||||
}
|
||||
|
||||
public void setCurrentAction(LogAction action) {
|
||||
businessAction.set(action);
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
processId.remove();
|
||||
businessAction.remove();
|
||||
}
|
||||
|
||||
public boolean hasProcessId() {
|
||||
return processId.get() != null;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.caliverse.admin.global.component.transaction;
|
||||
package com.caliverse.admin.global.component.manager;
|
||||
|
||||
import software.amazon.awssdk.enhanced.dynamodb.model.TransactWriteItemsEnhancedRequest;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.caliverse.admin.global.component.transaction;
|
||||
package com.caliverse.admin.global.component.manager;
|
||||
|
||||
import com.caliverse.admin.global.common.utils.CommonUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -1,163 +0,0 @@
|
||||
package com.caliverse.admin.global.configuration;
|
||||
|
||||
import com.caliverse.admin.domain.batch.CustomProcessor;
|
||||
import com.caliverse.admin.domain.batch.CustomReader;
|
||||
import com.caliverse.admin.domain.batch.CustomWriter;
|
||||
import org.springframework.batch.core.Job;
|
||||
import org.springframework.batch.core.Step;
|
||||
import org.springframework.batch.core.configuration.support.DefaultBatchConfiguration;
|
||||
import org.springframework.batch.core.job.builder.JobBuilder;
|
||||
import org.springframework.batch.core.repository.JobRepository;
|
||||
import org.springframework.batch.core.step.builder.StepBuilder;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
@Configuration
|
||||
public class BatchConfiguration {
|
||||
//public class BatchConfiguration extends DefaultBatchConfiguration {
|
||||
|
||||
// @Autowired
|
||||
// @Qualifier("dataSource")
|
||||
// private DataSource dataSource;
|
||||
//
|
||||
// @Autowired
|
||||
// @Qualifier("batchTransactionManager")
|
||||
// private PlatformTransactionManager transactionManger;
|
||||
//
|
||||
// @Override
|
||||
// public DataSource getDataSource() {
|
||||
// return dataSource;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public PlatformTransactionManager getTransactionManager() {
|
||||
// return transactionManger;
|
||||
//
|
||||
// }
|
||||
//
|
||||
//
|
||||
// @Bean
|
||||
// public Job createJob(JobRepository jobRepository, PlatformTransactionManager transactionManager) {
|
||||
// return new JobBuilder("testJob", jobRepository)
|
||||
// .flow(createStep(jobRepository, transactionManager)).end().build();
|
||||
// }
|
||||
//
|
||||
// @Bean
|
||||
// Step createStep(JobRepository jobRepository, PlatformTransactionManager transactionManager) {
|
||||
// return new StepBuilder("testStep", jobRepository)
|
||||
// .<String, String> chunk(3, transactionManager)
|
||||
// .allowStartIfComplete(true)
|
||||
// .reader(new CustomReader())
|
||||
// .processor(new CustomProcessor())
|
||||
// .writer(new CustomWriter())
|
||||
// .build();
|
||||
// }
|
||||
|
||||
|
||||
// @Bean
|
||||
// public org.springframework.batch.core.Job testJob(JobRepository jobRepository,PlatformTransactionManager transactionManager) throws DuplicateJobException {
|
||||
// org.springframework.batch.core.Job job = new JobBuilder("testJob",jobRepository)
|
||||
// .start(testStep(jobRepository,transactionManager))
|
||||
// .build();
|
||||
// return job;
|
||||
// }
|
||||
|
||||
// public Step testStep(JobRepository jobRepository,PlatformTransactionManager transactionManager){
|
||||
// Step step = new StepBuilder("testStep",jobRepository)
|
||||
// .tasklet(testTasklet(),transactionManager)
|
||||
// .build();
|
||||
// return step;
|
||||
// }
|
||||
|
||||
// public Tasklet testTasklet(){
|
||||
// return ((contribution, chunkContext) -> {
|
||||
// System.out.println("***** hello batch! *****");
|
||||
// // 원하는 비지니스 로직 작성
|
||||
// return RepeatStatus.FINISHED;
|
||||
// });
|
||||
// }
|
||||
|
||||
|
||||
// @Bean
|
||||
// public JobRepository jobRepository() {
|
||||
// JobRepositoryFactoryBean factory = new JobRepositoryFactoryBean();
|
||||
// factory.setDataSource(dataSource);
|
||||
// factory.setTransactionManager(transactionManager);
|
||||
// try {
|
||||
// return factory.getObject();
|
||||
// } catch (Exception e) {
|
||||
// // TODO Auto-generated catch block
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
|
||||
// @Bean
|
||||
// public JobLauncher jobLauncher() {
|
||||
// TaskExecutorJobLauncher jobLauncher = new TaskExecutorJobLauncher();
|
||||
// jobLauncher.setJobRepository(jobRepository());
|
||||
// jobLauncher.setTaskExecutor(new SyncTaskExecutor()); // Optional: You can use a different TaskExecutor
|
||||
// return jobLauncher;
|
||||
// }
|
||||
|
||||
// @Bean
|
||||
// public JobLauncher jobLauncher() {
|
||||
// JobLauncherFactoryBean factory = new JobLauncherFactoryBean();
|
||||
// factory.setJobRepository(jobRepository());
|
||||
// return factory.getObject();
|
||||
// }
|
||||
|
||||
// tag::readerwriterprocessor[]
|
||||
// @Bean
|
||||
// public FlatFileItemReader<Person> reader() {
|
||||
// return new FlatFileItemReaderBuilder<Person>()
|
||||
// .name("personItemReader")
|
||||
// .resource(new ClassPathResource("sample-data.csv"))
|
||||
// .delimited()
|
||||
// .names("firstName", "lastName")
|
||||
// .targetType(Person.class)
|
||||
// .build();
|
||||
// }
|
||||
|
||||
// @Bean
|
||||
// public PersonItemProcessor processor() {
|
||||
// return new PersonItemProcessor();
|
||||
// }
|
||||
|
||||
// @Bean
|
||||
// public JdbcBatchItemWriter<Person> writer(DataSource dataSource) {
|
||||
// return new JdbcBatchItemWriterBuilder<Person>()
|
||||
// .sql("INSERT INTO people (first_name, last_name) VALUES (:firstName, :lastName)")
|
||||
// .dataSource(dataSource)
|
||||
// .beanMapped()
|
||||
// .build();
|
||||
// }
|
||||
// // end::readerwriterprocessor[]
|
||||
|
||||
// // tag::jobstep[]
|
||||
// @Bean
|
||||
// public Job importUserJob(JobRepository jobRepository,Step step1, JobCompletionNotificationListener listener) {
|
||||
// return new JobBuilder("importUserJob", jobRepository)
|
||||
// .listener(listener)
|
||||
// .start(step1)
|
||||
// .build();
|
||||
// }
|
||||
|
||||
// @Bean
|
||||
// public Step step1(JobRepository jobRepository, DataSourceTransactionManager transactionManager,
|
||||
// FlatFileItemReader<Person> reader, PersonItemProcessor processor, JdbcBatchItemWriter<Person> writer) {
|
||||
// return new StepBuilder("step1", jobRepository)
|
||||
// .<Person, Person> chunk(3, transactionManager)
|
||||
// .reader(reader)
|
||||
// .processor(processor)
|
||||
// .writer(writer)
|
||||
// .build();
|
||||
|
||||
// end::jobstep[]
|
||||
|
||||
}
|
||||
@@ -1,9 +1,12 @@
|
||||
package com.caliverse.admin.global.configuration;
|
||||
|
||||
import com.caliverse.admin.global.component.MysqlLoggingInterceptor;
|
||||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
import org.mybatis.spring.SqlSessionFactoryBean;
|
||||
import org.mybatis.spring.SqlSessionTemplate;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.mybatis.spring.boot.autoconfigure.ConfigurationCustomizer;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
@@ -32,10 +35,18 @@ public class MybatisConfig {
|
||||
|
||||
|
||||
@Bean(name = "SqlSessionFactory")
|
||||
public SqlSessionFactory SqlSessionFactory(@Qualifier("dataSource") DataSource DataSource, ApplicationContext applicationContext) throws Exception {
|
||||
public SqlSessionFactory SqlSessionFactory(
|
||||
@Qualifier("dataSource") DataSource DataSource,
|
||||
ApplicationContext applicationContext,
|
||||
@Autowired(required = false)MysqlLoggingInterceptor interceptor
|
||||
) throws Exception {
|
||||
SqlSessionFactoryBean sqlSessionFactoryBean = new SqlSessionFactoryBean();
|
||||
sqlSessionFactoryBean.setDataSource(DataSource);
|
||||
sqlSessionFactoryBean.setMapperLocations(applicationContext.getResources(mPath));
|
||||
|
||||
if (interceptor != null) {
|
||||
sqlSessionFactoryBean.setPlugins(interceptor);
|
||||
}
|
||||
return sqlSessionFactoryBean.getObject();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,162 +0,0 @@
|
||||
package com.caliverse.admin.global.configuration;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.springframework.batch.core.Job;
|
||||
import org.springframework.batch.core.Step;
|
||||
import org.springframework.batch.core.configuration.support.DefaultBatchConfiguration;
|
||||
import org.springframework.batch.core.job.builder.JobBuilder;
|
||||
import org.springframework.batch.core.repository.JobRepository;
|
||||
import org.springframework.batch.core.step.builder.StepBuilder;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
import com.caliverse.admin.domain.batch.CustomProcessor;
|
||||
import com.caliverse.admin.domain.batch.CustomReader;
|
||||
import com.caliverse.admin.domain.batch.CustomWriter;
|
||||
|
||||
@Configuration
|
||||
//public class TestBatchConfiguration extends DefaultBatchConfiguration {
|
||||
public class TestBatchConfiguration {
|
||||
// @Autowired
|
||||
// @Qualifier("dataSource-normal")
|
||||
// private DataSource dataSource;
|
||||
//
|
||||
// @Autowired
|
||||
// @Qualifier("batchTransactionManager")
|
||||
// private PlatformTransactionManager transactionManger;
|
||||
//
|
||||
// @Override
|
||||
// public DataSource getDataSource() {
|
||||
// return dataSource;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public PlatformTransactionManager getTransactionManager() {
|
||||
// return transactionManger;
|
||||
//
|
||||
// }
|
||||
//
|
||||
//
|
||||
// @Bean
|
||||
// public Job createJob(JobRepository jobRepository, PlatformTransactionManager transactionManager) {
|
||||
// return new JobBuilder("testJob", jobRepository)
|
||||
// .flow(createStep(jobRepository, transactionManager)).end().build();
|
||||
// }
|
||||
//
|
||||
// @Bean
|
||||
// Step createStep(JobRepository jobRepository, PlatformTransactionManager transactionManager) {
|
||||
// return new StepBuilder("testStep", jobRepository)
|
||||
// .<String, String> chunk(3, transactionManager)
|
||||
// .allowStartIfComplete(true)
|
||||
// .reader(new CustomReader())
|
||||
// .processor(new CustomProcessor())
|
||||
// .writer(new CustomWriter())
|
||||
// .build();
|
||||
// }
|
||||
|
||||
|
||||
// @Bean
|
||||
// public org.springframework.batch.core.Job testJob(JobRepository jobRepository,PlatformTransactionManager transactionManager) throws DuplicateJobException {
|
||||
// org.springframework.batch.core.Job job = new JobBuilder("testJob",jobRepository)
|
||||
// .start(testStep(jobRepository,transactionManager))
|
||||
// .build();
|
||||
// return job;
|
||||
// }
|
||||
|
||||
// public Step testStep(JobRepository jobRepository,PlatformTransactionManager transactionManager){
|
||||
// Step step = new StepBuilder("testStep",jobRepository)
|
||||
// .tasklet(testTasklet(),transactionManager)
|
||||
// .build();
|
||||
// return step;
|
||||
// }
|
||||
|
||||
// public Tasklet testTasklet(){
|
||||
// return ((contribution, chunkContext) -> {
|
||||
// System.out.println("***** hello batch! *****");
|
||||
// // 원하는 비지니스 로직 작성
|
||||
// return RepeatStatus.FINISHED;
|
||||
// });
|
||||
// }
|
||||
|
||||
|
||||
// @Bean
|
||||
// public JobRepository jobRepository() {
|
||||
// JobRepositoryFactoryBean factory = new JobRepositoryFactoryBean();
|
||||
// factory.setDataSource(dataSource);
|
||||
// factory.setTransactionManager(transactionManager);
|
||||
// try {
|
||||
// return factory.getObject();
|
||||
// } catch (Exception e) {
|
||||
// // TODO Auto-generated catch block
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
|
||||
// @Bean
|
||||
// public JobLauncher jobLauncher() {
|
||||
// TaskExecutorJobLauncher jobLauncher = new TaskExecutorJobLauncher();
|
||||
// jobLauncher.setJobRepository(jobRepository());
|
||||
// jobLauncher.setTaskExecutor(new SyncTaskExecutor()); // Optional: You can use a different TaskExecutor
|
||||
// return jobLauncher;
|
||||
// }
|
||||
|
||||
// @Bean
|
||||
// public JobLauncher jobLauncher() {
|
||||
// JobLauncherFactoryBean factory = new JobLauncherFactoryBean();
|
||||
// factory.setJobRepository(jobRepository());
|
||||
// return factory.getObject();
|
||||
// }
|
||||
|
||||
// tag::readerwriterprocessor[]
|
||||
// @Bean
|
||||
// public FlatFileItemReader<Person> reader() {
|
||||
// return new FlatFileItemReaderBuilder<Person>()
|
||||
// .name("personItemReader")
|
||||
// .resource(new ClassPathResource("sample-data.csv"))
|
||||
// .delimited()
|
||||
// .names("firstName", "lastName")
|
||||
// .targetType(Person.class)
|
||||
// .build();
|
||||
// }
|
||||
|
||||
// @Bean
|
||||
// public PersonItemProcessor processor() {
|
||||
// return new PersonItemProcessor();
|
||||
// }
|
||||
|
||||
// @Bean
|
||||
// public JdbcBatchItemWriter<Person> writer(DataSource dataSource) {
|
||||
// return new JdbcBatchItemWriterBuilder<Person>()
|
||||
// .sql("INSERT INTO people (first_name, last_name) VALUES (:firstName, :lastName)")
|
||||
// .dataSource(dataSource)
|
||||
// .beanMapped()
|
||||
// .build();
|
||||
// }
|
||||
// // end::readerwriterprocessor[]
|
||||
|
||||
// // tag::jobstep[]
|
||||
// @Bean
|
||||
// public Job importUserJob(JobRepository jobRepository,Step step1, JobCompletionNotificationListener listener) {
|
||||
// return new JobBuilder("importUserJob", jobRepository)
|
||||
// .listener(listener)
|
||||
// .start(step1)
|
||||
// .build();
|
||||
// }
|
||||
|
||||
// @Bean
|
||||
// public Step step1(JobRepository jobRepository, DataSourceTransactionManager transactionManager,
|
||||
// FlatFileItemReader<Person> reader, PersonItemProcessor processor, JdbcBatchItemWriter<Person> writer) {
|
||||
// return new StepBuilder("step1", jobRepository)
|
||||
// .<Person, Person> chunk(3, transactionManager)
|
||||
// .reader(reader)
|
||||
// .processor(processor)
|
||||
// .writer(writer)
|
||||
// .build();
|
||||
|
||||
// end::jobstep[]
|
||||
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.caliverse.admin.mongodb;
|
||||
|
||||
import com.caliverse.admin.domain.adminlog.FieldChange;
|
||||
import com.caliverse.admin.domain.entity.FieldChange;
|
||||
import com.caliverse.admin.dynamodb.domain.DocAttributeHandler;
|
||||
import com.caliverse.admin.dynamodb.domain.doc.DynamoDBDocBase;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.caliverse.admin.mongodb.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class BatchJobDomain {
|
||||
private String jobName;
|
||||
private Long duration;
|
||||
private Object info;
|
||||
private String query;
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.caliverse.admin.mongodb.domain;
|
||||
|
||||
import com.caliverse.admin.domain.entity.log.LogAction;
|
||||
import com.caliverse.admin.domain.entity.log.LogCategory;
|
||||
import com.caliverse.admin.domain.entity.log.LogStatus;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.mongodb.core.index.CompoundIndex;
|
||||
import org.springframework.data.mongodb.core.index.Indexed;
|
||||
import org.springframework.data.mongodb.core.mapping.Document;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Document(collection = "businessLog")
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class BusinessLog {
|
||||
@Id
|
||||
private String id;
|
||||
|
||||
@Indexed
|
||||
private LocalDateTime logTime;
|
||||
|
||||
@Indexed
|
||||
private LogCategory category;
|
||||
|
||||
@Indexed
|
||||
private LogAction action;
|
||||
|
||||
@Indexed
|
||||
private LogStatus status;
|
||||
|
||||
private String worker;
|
||||
private String workerIp;
|
||||
|
||||
private String message;
|
||||
|
||||
private String procId;
|
||||
|
||||
private Object domain;
|
||||
|
||||
@CompoundIndex(def = "{'category': 1, 'action': 1, 'logTime': -1}")
|
||||
@CompoundIndex(def = "{'status': 1, 'logTime': -1}")
|
||||
@CompoundIndex(def = "{'procId': 1, 'logTime': -1}")
|
||||
@CompoundIndex(def = "{'category': 1, 'logTime': -1}")
|
||||
@CompoundIndex(def = "{'action': 1, 'logTime': -1}")
|
||||
public static class Indexes {}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.caliverse.admin.mongodb.domain;
|
||||
|
||||
import com.caliverse.admin.domain.entity.EInitDataType;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class DataInitDomain {
|
||||
private EInitDataType initDataType;
|
||||
private Object key;
|
||||
private Object data;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.caliverse.admin.mongodb.domain;
|
||||
|
||||
import com.caliverse.admin.domain.entity.FieldChange;
|
||||
import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
|
||||
import com.caliverse.admin.dynamodb.domain.doc.DynamoDBDocBase;
|
||||
import com.caliverse.admin.mongodb.entity.EDBOperationType;
|
||||
import lombok.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class DynamodbDomain {
|
||||
|
||||
private EDBOperationType operationType;
|
||||
private HISTORYTYPEDETAIL historyType;
|
||||
private DynamoDBDocBase data;
|
||||
private List<FieldChange> changed;
|
||||
private String tableName;
|
||||
private String tranId;
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.caliverse.admin.mongodb.domain;
|
||||
|
||||
import com.caliverse.admin.domain.adminlog.FieldChange;
|
||||
import com.caliverse.admin.domain.entity.FieldChange;
|
||||
import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
|
||||
import com.caliverse.admin.dynamodb.domain.doc.DynamoDBDocBase;
|
||||
import com.caliverse.admin.global.common.utils.DateUtils;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.caliverse.admin.mongodb.domain;
|
||||
|
||||
import com.caliverse.admin.domain.adminlog.FieldChange;
|
||||
import com.caliverse.admin.domain.entity.FieldChange;
|
||||
import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
|
||||
import com.caliverse.admin.mongodb.entity.DBType;
|
||||
import com.caliverse.admin.mongodb.entity.EDBOperationType;
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.caliverse.admin.mongodb.domain;
|
||||
|
||||
import com.caliverse.admin.domain.entity.FieldChange;
|
||||
import com.caliverse.admin.mongodb.entity.EDBOperationType;
|
||||
import lombok.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class MariadbDomain {
|
||||
|
||||
private Object data;
|
||||
private EDBOperationType operationType;
|
||||
private List<FieldChange> changed;
|
||||
private String tableName;
|
||||
private String tranId;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.caliverse.admin.mongodb.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class MessageQueueDomain {
|
||||
private String queueName;
|
||||
private String targetServer;
|
||||
private Object messageContent;
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.caliverse.admin.mongodb.domain;
|
||||
|
||||
import com.caliverse.admin.domain.adminlog.FieldChange;
|
||||
import com.caliverse.admin.domain.entity.FieldChange;
|
||||
import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
|
||||
import com.caliverse.admin.global.common.utils.DateUtils;
|
||||
import com.caliverse.admin.mongodb.entity.DBType;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user