HISTORYTYPE > HISTORYDETAILTYPE 변경

로그 유저 아닐시 시스템으로 남기게 변경
히스토리 남기는 방식 추가 적용
HistoryRequest 생성
히스토리 API 작업
히스토리 mongodb 조회
This commit is contained in:
2025-05-22 14:54:43 +09:00
parent ed072b94c0
commit 3ca0ea4bb5
102 changed files with 1384 additions and 1266 deletions

View File

@@ -1,13 +1,11 @@
package com.caliverse.admin.domain.adminlog; package com.caliverse.admin.domain.adminlog;
import com.caliverse.admin.domain.entity.HISTORYTYPE; import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
import org.json.JSONObject;
import org.springframework.stereotype.Service;
public class AdminItemDeleteLog extends AdminLogBase { public class AdminItemDeleteLog extends AdminLogBase {
public AdminItemDeleteLog(String userGuid, String itemGuid, String itemCount){ public AdminItemDeleteLog(String userGuid, String itemGuid, String itemCount){
super(HISTORYTYPE.USER_ITEM_DELETE); super(HISTORYTYPEDETAIL.USER_ITEM_DELETE);
var jsonObject = getJsonContentObject(); var jsonObject = getJsonContentObject();

View File

@@ -2,7 +2,7 @@ package com.caliverse.admin.domain.adminlog;
import com.caliverse.admin.domain.dao.admin.HistoryMapper; import com.caliverse.admin.domain.dao.admin.HistoryMapper;
import com.caliverse.admin.domain.entity.HISTORYTYPE; import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
import com.caliverse.admin.global.common.utils.CommonUtils; import com.caliverse.admin.global.common.utils.CommonUtils;
import com.caliverse.admin.global.component.AdminApplicationContextProvider; import com.caliverse.admin.global.component.AdminApplicationContextProvider;
import lombok.Getter; import lombok.Getter;
@@ -21,7 +21,7 @@ public abstract class AdminLogBase implements IAdminLog{
private final HistoryMapper historyMapper; private final HistoryMapper historyMapper;
private static ApplicationContext context; private static ApplicationContext context;
private final HISTORYTYPE historyType; private final HISTORYTYPEDETAIL historyType;
protected Map<String, Object> map; protected Map<String, Object> map;
@@ -29,7 +29,7 @@ public abstract class AdminLogBase implements IAdminLog{
protected JSONObject jsonContentObject = new JSONObject(); protected JSONObject jsonContentObject = new JSONObject();
public AdminLogBase(HISTORYTYPE historyType) { public AdminLogBase(HISTORYTYPEDETAIL historyType) {
this.historyMapper = AdminApplicationContextProvider.getContext().getBean(HistoryMapper.class); this.historyMapper = AdminApplicationContextProvider.getContext().getBean(HistoryMapper.class);
this.historyType = historyType; this.historyType = historyType;
@@ -49,7 +49,7 @@ public abstract class AdminLogBase implements IAdminLog{
Long adminId = 0L; Long adminId = 0L;
String adminName = ""; String adminName = "";
String adminMail = ""; String adminMail = "";
HISTORYTYPE type = HISTORYTYPE.NONE; HISTORYTYPEDETAIL type = HISTORYTYPEDETAIL.NONE;
try { try {
adminId = CommonUtils.getAdmin().getId(); adminId = CommonUtils.getAdmin().getId();
adminName = CommonUtils.getAdmin().getName(); adminName = CommonUtils.getAdmin().getName();

View File

@@ -1,12 +1,11 @@
package com.caliverse.admin.domain.adminlog; package com.caliverse.admin.domain.adminlog;
import com.caliverse.admin.domain.entity.AdminLog; import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
import com.caliverse.admin.domain.entity.HISTORYTYPE;
public class AdminLoginPermitLog extends AdminLogBase { public class AdminLoginPermitLog extends AdminLogBase {
public AdminLoginPermitLog() { public AdminLoginPermitLog() {
super(HISTORYTYPE.LOGIN_PERMITTED); super(HISTORYTYPEDETAIL.LOGIN_PERMITTED);

View File

@@ -1,12 +1,12 @@
package com.caliverse.admin.domain.adminlog; package com.caliverse.admin.domain.adminlog;
import com.caliverse.admin.domain.entity.HISTORYTYPE; import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
public class AdminPasswordInitLog extends AdminLogBase { public class AdminPasswordInitLog extends AdminLogBase {
public AdminPasswordInitLog(String name, String email) { public AdminPasswordInitLog(String name, String email) {
super(HISTORYTYPE.PASSWORD_INIT); super(HISTORYTYPEDETAIL.PASSWORD_INIT);
var jsonObject = getJsonContentObject(); var jsonObject = getJsonContentObject();

View File

@@ -1,6 +1,7 @@
package com.caliverse.admin.domain.api; package com.caliverse.admin.domain.api;
import com.caliverse.admin.domain.request.AuthenticateRequest; import com.caliverse.admin.domain.request.AuthenticateRequest;
import com.caliverse.admin.domain.request.DataRequest;
import com.caliverse.admin.domain.request.LogGenericRequest; import com.caliverse.admin.domain.request.LogGenericRequest;
import com.caliverse.admin.domain.response.DataResponse; import com.caliverse.admin.domain.response.DataResponse;
import com.caliverse.admin.domain.response.LogResponse; import com.caliverse.admin.domain.response.LogResponse;
@@ -41,13 +42,13 @@ public class DataController {
//데이터 초기화 //데이터 초기화
@PostMapping("/init-data") @PostMapping("/init-data")
public ResponseEntity<DataResponse> initData(@RequestBody AuthenticateRequest authenticateRequest){ public ResponseEntity<DataResponse> initData(@RequestBody DataRequest dataRequest){
if(activeProfile.equals("live")){ if(activeProfile.equals("live")){
return ResponseEntity.status(HttpStatus.NOT_FOUND).body(DataResponse.builder() return ResponseEntity.status(HttpStatus.NOT_FOUND).body(DataResponse.builder()
.status(CommonCode.ERROR.getHttpStatus()) .status(CommonCode.ERROR.getHttpStatus())
.result(ErrorCode.NOT_FOUNT_API.toString()) .result(ErrorCode.NOT_FOUNT_API.toString())
.build()); .build());
} }
return ResponseEntity.ok().body(dataService.initData(authenticateRequest)); return ResponseEntity.ok().body(dataService.initData(dataRequest));
} }
} }

View File

@@ -1,5 +1,6 @@
package com.caliverse.admin.domain.api; package com.caliverse.admin.domain.api;
import com.caliverse.admin.domain.request.HistoryRequest;
import com.caliverse.admin.domain.response.HistoryResponse; import com.caliverse.admin.domain.response.HistoryResponse;
import com.caliverse.admin.domain.service.HistoryService; import com.caliverse.admin.domain.service.HistoryService;
@@ -29,4 +30,9 @@ public class HistoryController {
@PathVariable("id") String id){ @PathVariable("id") String id){
return ResponseEntity.ok().body(historyService.getHistoryDetail(id)); return ResponseEntity.ok().body(historyService.getHistoryDetail(id));
} }
@PostMapping("/change-list")
public ResponseEntity<HistoryResponse> getHistory(
@RequestBody HistoryRequest historyRequest){
return ResponseEntity.ok().body(historyService.getHistory(historyRequest));
}
} }

View File

@@ -1,6 +1,7 @@
package com.caliverse.admin.domain.dao.admin; package com.caliverse.admin.domain.dao.admin;
import com.caliverse.admin.domain.entity.*; import com.caliverse.admin.domain.entity.*;
import com.caliverse.admin.domain.request.DataRequest;
import com.caliverse.admin.domain.request.LandRequest; import com.caliverse.admin.domain.request.LandRequest;
import org.apache.ibatis.annotations.*; import org.apache.ibatis.annotations.*;
@@ -20,9 +21,21 @@ public interface DataMapper {
}) })
List<DataInit> getDataInit(); List<DataInit> getDataInit();
@Select("SELECT * FROM data_initialize_schedule WHERE status = 'WAIT' AND id = #{id}")
@Results({
@Result(property = "id", column = "id"),
@Result(property = "dataType", column = "data_type"),
@Result(property = "status", column = "status"),
@Result(property = "deleted", column = "deleted"),
@Result(property = "createBy", column = "create_by"),
@Result(property = "createDt", column = "create_dt"),
})
DataInit getDataInitDetail(@Param("id") long id);
@Update("UPDATE data_initialize_schedule SET status = #{status} WHERE id = #{id}") @Update("UPDATE data_initialize_schedule SET status = #{status} WHERE id = #{id}")
int updateStatus(@Param("id") long id, @Param("status") String status); int updateStatus(@Param("id") long id, @Param("status") String status);
@Insert("INSERT INTO data_initialize_schedule (data_type, create_by) VALUES (#{dataType}, #{createBy})") @Insert("INSERT INTO data_initialize_schedule (data_type, create_by) VALUES (#{request.initDataType}, #{request.createBy})")
int postDataInit(@Param("dataType") EInitDataType dataType, @Param("createBy") long createBy); @Options(useGeneratedKeys = true, keyProperty = "request.id", keyColumn = "id")
int postDataInit(@Param("request") DataRequest request);
} }

View File

@@ -4,63 +4,28 @@ public enum HISTORYTYPE {
NONE("기본"), NONE("기본"),
LOGIN_PERMITTED("로그인 승인"), LOGIN_PERMITTED("로그인 승인"),
ADMIN_INFO_UPDATE("운영자 정보 수정"), ADMIN_INFO("운영자 정보"),
ADMIN_INFO_DELETE("운영자 정보 삭제"),
PASSWORD_INIT("비밀번호 초기화"), PASSWORD_INIT("비밀번호 초기화"),
USER_INFO_UPDATE("유저 정보 변경"), USER_INFO("유저 정보"),
GROUP_AUTH_UPDATE("그룹 권한 수정"), GROUP_AUTH("그룹 권한"),
GROUP_DELETE("그룹 삭제"), GROUP_DELETE("그룹 삭제"),
NOTICE_DELETE("공지사항 삭제"), NOTICE("공지사항"),
NOTICE_ADD("공지사항 등록"), MAIL("우편"),
NOTICE_UPDATE("공지사항 수정"), BLACKLIST("유저 제재"),
NOTICE_SEND_FAIL("공지사항 전송 실패"),
MAIL_DELETE("우편 삭제"),
MAIL_ADD("우편 등록"),
MAIL_UPDATE("우편 수정"),
MAIL_SEND("우편 전송"),
MAIL_SEND_FAIL("우편 전송 실패"),
MAIL_ITEM_DELETE("우편 아이템 삭제"),
MAIL_ITEM_UPDATE("우편 아이템 수정"),
WHITELIST_DELETE("화이트리스트 삭제"),
BLACKLIST_UPDATE("유저 제재 수정"),
BLACKLIST_DELETE("유저 제재 삭제"),
REPORT_DELETE("신고내역 삭제"), REPORT_DELETE("신고내역 삭제"),
USER_ITEM_DELETE("유저 아이템 삭제"), USER_ITEM("유저 아이템"),
SCHEDULE_MAIL_FAIL("메일 스케줄 실패"), USER_MAIL("유저 메일"),
SCHEDULE_NOTICE_FAIL("공지 스케줄 실패"), EVENT("이벤트"),
SCHEDULE_EVENT_FAIL("이벤트 스케줄 실패"), CALIUM("칼리움 요청"),
USER_MAIL_DELETE("유저 메일 삭제"), LAND_AUCTION("랜드경매"),
INVENTORY_ITEM_DELETE("인벤토리 아이템 삭제"), BATTLE_EVENT("전투시스템 이벤트"),
INVENTORY_ITEM_UPDATE("인벤토리 아이템 수정"), LAND("랜드"),
EVENT_ADD("이벤트 등록"), MENU_BANNER("메뉴 배너"),
EVENT_UPDATE("이벤트 수정"), ITEM("아이템"),
EVENT_DELETE("이벤트 삭제"),
CALIUM_ADD("칼리움 요청 등록"),
CALIUM_SAVE("칼리움 저장"),
CALIUM_TRANSFER("칼리움 전송"),
CALIUM_TOTAL_UPDATE("칼리움 충전"),
LAND_AUCTION_ADD("랜드경매 등록"),
LAND_AUCTION_UPDATE("랜드경매 수정"),
LAND_AUCTION_DELETE("랜드경매 삭제"),
BATTLE_EVENT_ADD("전투시스템 이벤트 등록"),
BATTLE_EVENT_UPDATE("전투시스템 이벤트 수정"),
BATTLE_EVENT_DELETE("전투시스템 이벤트 삭제"),
LAND_OWNER_CHANGE_ADD("랜드 소유권 변경 등록"),
LAND_OWNER_CHANGE_UPDATE("랜드 소유권 변경 수정"),
LAND_OWNER_CHANGE_DELETE("랜드 소유권 변경 예약 취소"),
LAND_OWNER_CHANGE_MAIL("랜드 소유권 변경 우편"),
LAND_OWNED_INITIALIZE("랜드 소유권 정보 초기화"),
LAND_DESC_INITIALIZE("랜드 정보 초기화"),
LAND_AUCTION_INITIALIZE("랜드 경매 초기화"),
MENU_BANNER_ADD("메뉴 배너 등록"),
MENU_BANNER_UPDATE("메뉴 배너 수정"),
MENU_BANNER_DELETE("메뉴 배너 삭제"),
ITEM_UPDATE("아이템 수정"),
ITEM_DELETE("아이템 삭제"),
USER_ADMIN_AUTH_UPDATE("유저 관리자 권한 수정"), USER_ADMIN_AUTH_UPDATE("유저 관리자 권한 수정"),
NICKNAME_REGISTRY_DELETE("닉네임 레지스트리 삭제"), NICKNAME_REGISTRY("닉네임 레지스트리 삭제"),
NICKNAME_REGISTRY_ADD("닉네임 레지스트리 등록"), NICKNAME("닉네임"),
NICKNAME_UPDATE("닉네임 수정") DATA_INIT("데이터 초기화")
; ;
private String historyType; private String historyType;
HISTORYTYPE(String type) { HISTORYTYPE(String type) {

View File

@@ -0,0 +1,70 @@
package com.caliverse.admin.domain.entity;
public enum HISTORYTYPEDETAIL {
NONE("기본"),
LOGIN_PERMITTED("로그인 승인"),
ADMIN_INFO_UPDATE("운영자 정보 수정"),
ADMIN_INFO_DELETE("운영자 정보 삭제"),
PASSWORD_INIT("비밀번호 초기화"),
USER_INFO_UPDATE("유저 정보 변경"),
GROUP_AUTH_UPDATE("그룹 권한 수정"),
GROUP_DELETE("그룹 삭제"),
NOTICE_DELETE("공지사항 삭제"),
NOTICE_ADD("공지사항 등록"),
NOTICE_UPDATE("공지사항 수정"),
NOTICE_SEND_FAIL("공지사항 전송 실패"),
MAIL_DELETE("우편 삭제"),
MAIL_ADD("우편 등록"),
MAIL_UPDATE("우편 수정"),
MAIL_SEND("우편 전송"),
MAIL_SEND_FAIL("우편 전송 실패"),
MAIL_ITEM_DELETE("우편 아이템 삭제"),
MAIL_ITEM_UPDATE("우편 아이템 수정"),
BLACKLIST_ADD("유저 제재 등록"),
BLACKLIST_UPDATE("유저 제재 수정"),
BLACKLIST_DELETE("유저 제재 삭제"),
REPORT_DELETE("신고내역 삭제"),
USER_ITEM_DELETE("유저 아이템 삭제"),
SCHEDULE_MAIL_FAIL("메일 스케줄 실패"),
SCHEDULE_NOTICE_FAIL("공지 스케줄 실패"),
SCHEDULE_EVENT_FAIL("이벤트 스케줄 실패"),
USER_MAIL_DELETE("유저 메일 삭제"),
INVENTORY_ITEM_DELETE("인벤토리 아이템 삭제"),
INVENTORY_ITEM_UPDATE("인벤토리 아이템 수정"),
EVENT_ADD("이벤트 등록"),
EVENT_UPDATE("이벤트 수정"),
EVENT_DELETE("이벤트 삭제"),
CALIUM_ADD("칼리움 요청 등록"),
CALIUM_SAVE("칼리움 저장"),
CALIUM_TRANSFER("칼리움 전송"),
CALIUM_TOTAL_UPDATE("칼리움 충전"),
LAND_AUCTION_ADD("랜드경매 등록"),
LAND_AUCTION_UPDATE("랜드경매 수정"),
LAND_AUCTION_DELETE("랜드경매 삭제"),
BATTLE_EVENT_ADD("전투시스템 이벤트 등록"),
BATTLE_EVENT_UPDATE("전투시스템 이벤트 수정"),
BATTLE_EVENT_DELETE("전투시스템 이벤트 삭제"),
LAND_OWNER_CHANGE_ADD("랜드 소유권 변경 등록"),
LAND_OWNER_CHANGE_UPDATE("랜드 소유권 변경 수정"),
LAND_OWNER_CHANGE_DELETE("랜드 소유권 변경 예약 취소"),
LAND_OWNER_CHANGE_MAIL("랜드 소유권 변경 우편"),
LAND_OWNED_INITIALIZE("랜드 소유권 정보 초기화"),
LAND_DESC_INITIALIZE("랜드 정보 초기화"),
LAND_AUCTION_INITIALIZE("랜드 경매 초기화"),
MENU_BANNER_ADD("메뉴 배너 등록"),
MENU_BANNER_UPDATE("메뉴 배너 수정"),
MENU_BANNER_DELETE("메뉴 배너 삭제"),
ITEM_UPDATE("아이템 수정"),
ITEM_DELETE("아이템 삭제"),
USER_ADMIN_AUTH_UPDATE("유저 관리자 권한 수정"),
NICKNAME_REGISTRY_DELETE("닉네임 레지스트리 삭제"),
NICKNAME_REGISTRY_ADD("닉네임 레지스트리 등록"),
NICKNAME_UPDATE("닉네임 수정"),
DATA_INIT_ADD("데이터 초기화 등록")
;
private String historyTypeDetail;
HISTORYTYPEDETAIL(String type) {
this.historyTypeDetail = type;
}
}

View File

@@ -23,7 +23,7 @@ public class Log {
private String name; private String name;
private String mail; private String mail;
@JsonProperty("history_type") @JsonProperty("history_type")
private HISTORYTYPE historyType; private HISTORYTYPEDETAIL historyType;
private String content; private String content;
@JsonProperty("create_dt") @JsonProperty("create_dt")
private LocalDateTime createDt; private LocalDateTime createDt;

View File

@@ -9,12 +9,10 @@ import lombok.*;
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
public class AuthenticateRequest { public class AuthenticateRequest {
private int id;
private String name; private String name;
private String email; private String email;
private String password; private String password;
@JsonProperty("new_password") @JsonProperty("new_password")
private String newPassword; private String newPassword;
@JsonProperty("init_data_type")
private EInitDataType initDataType;
} }

View File

@@ -0,0 +1,20 @@
package com.caliverse.admin.domain.request;
import com.caliverse.admin.domain.entity.EInitDataType;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class DataRequest {
private Long id;
@JsonProperty("init_data_type")
private EInitDataType initDataType;
@JsonProperty("create_by")
private Long createBy;
}

View File

@@ -1,23 +1,34 @@
package com.caliverse.admin.domain.request; package com.caliverse.admin.domain.request;
import com.caliverse.admin.domain.entity.HISTORYTYPE; import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
import com.caliverse.admin.domain.entity.SEARCHTYPE; import com.caliverse.admin.domain.entity.SEARCHTYPE;
import com.caliverse.admin.mongodb.entity.DBType;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter; import lombok.Data;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@Getter @Data
public class HistoryRequest { public class HistoryRequest {
@JsonProperty("search_type")
private SEARCHTYPE searchType;
@JsonProperty("search_key")
private String searchKey;
@JsonProperty("history_type")
private HISTORYTYPE historyType; // 사용 이력
@JsonProperty("start_dt") @JsonProperty("start_dt")
private LocalDateTime startDt; private LocalDateTime startDt;
@JsonProperty("end_dt") @JsonProperty("end_dt")
private LocalDateTime endDt; private LocalDateTime endDt;
@JsonProperty("history_type")
private HISTORYTYPEDETAIL historyType;
@JsonProperty("user_mail")
private String userMail;
@JsonProperty("db_type")
private DBType dbType;
@JsonProperty("search_type")
private SEARCHTYPE searchType;
@JsonProperty("search_key")
private String searchKey;
@JsonProperty("sql_id")
private long sqlId;
@JsonProperty("table_name")
private String tableName;
} }

View File

@@ -72,7 +72,7 @@ public class MailRequest {
@JsonProperty("mail_guid") @JsonProperty("mail_guid")
private String MailGuid; private String MailGuid;
@JsonProperty("item_id") @JsonProperty("item_id")
private Long itemId; private Integer itemId;
@JsonProperty("parrent_count") @JsonProperty("parrent_count")
private Double parrentCount; private Double parrentCount;
private Double count; private Double count;

View File

@@ -1,6 +1,5 @@
package com.caliverse.admin.domain.response; package com.caliverse.admin.domain.response;
import com.caliverse.admin.history.domain.DynamodbDataInitializeHistory;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
@@ -8,8 +7,6 @@ import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import java.util.List;
@Data @Data
@Builder @Builder
@AllArgsConstructor @AllArgsConstructor

View File

@@ -1,6 +1,6 @@
package com.caliverse.admin.domain.response; package com.caliverse.admin.domain.response;
import com.caliverse.admin.history.domain.DynamodbDataInitializeHistory; import com.caliverse.admin.mongodb.domain.APILogInfo;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
@@ -28,7 +28,7 @@ public class DataResponse {
public static class ResultData { public static class ResultData {
@JsonProperty("init_list") @JsonProperty("init_list")
List<DynamodbDataInitializeHistory> dataInitList; List<APILogInfo> dataInitList;
private String message; private String message;

View File

@@ -1,6 +1,7 @@
package com.caliverse.admin.domain.response; package com.caliverse.admin.domain.response;
import com.caliverse.admin.domain.entity.Log; import com.caliverse.admin.domain.entity.Log;
import com.caliverse.admin.mongodb.domain.HistoryLogInfoBase;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
@@ -28,7 +29,8 @@ public class HistoryResponse {
private String message; private String message;
@JsonProperty("list") @JsonProperty("list")
private List<Log> list ; // private List<Log> list ;
private List<HistoryLogInfoBase> list ;
private String content; // db에 text유형의 데이터를 가져옴 private String content; // db에 text유형의 데이터를 가져옴

View File

@@ -49,7 +49,7 @@ public class ItemsResponse {
@Data @Data
@Builder @Builder
public static class Item{ public static class Item{
private Integer id; private String id;
@JsonProperty("user_guid") @JsonProperty("user_guid")
private String userGuid; private String userGuid;
@JsonProperty("item_guid") @JsonProperty("item_guid")

View File

@@ -4,7 +4,6 @@ import com.caliverse.admin.domain.adminlog.AdminPasswordInitLog;
import com.caliverse.admin.domain.adminlog.IAdminLog; import com.caliverse.admin.domain.adminlog.IAdminLog;
import com.caliverse.admin.domain.dao.admin.AdminMapper; import com.caliverse.admin.domain.dao.admin.AdminMapper;
import com.caliverse.admin.domain.dao.admin.GroupMapper; 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.*;
import com.caliverse.admin.domain.request.AdminRequest; import com.caliverse.admin.domain.request.AdminRequest;
import com.caliverse.admin.domain.request.AuthenticateRequest; import com.caliverse.admin.domain.request.AuthenticateRequest;
@@ -196,7 +195,7 @@ public class AdminService {
jsonObject.put("email",item.getEmail()); jsonObject.put("email",item.getEmail());
// map.put("content",jsonObject.toString()); // map.put("content",jsonObject.toString());
// historyMapper.saveLog(map); // historyMapper.saveLog(map);
historyService.setLog(HISTORYTYPE.LOGIN_PERMITTED, jsonObject); historyService.setLog(HISTORYTYPEDETAIL.LOGIN_PERMITTED, jsonObject);
} }
); );
@@ -240,7 +239,7 @@ public class AdminService {
jsonObject.put("Authority(after)", afterGroup != null? afterGroup.get("name"):""); jsonObject.put("Authority(after)", afterGroup != null? afterGroup.get("name"):"");
// map.put("content",jsonObject.toString()); // map.put("content",jsonObject.toString());
// historyMapper.saveLog(map); // historyMapper.saveLog(map);
historyService.setLog(HISTORYTYPE.ADMIN_INFO_UPDATE, jsonObject); historyService.setLog(HISTORYTYPEDETAIL.ADMIN_INFO_UPDATE, jsonObject);
} }
); );
@@ -275,7 +274,7 @@ public class AdminService {
jsonObject.put("email",item.getEmail()); jsonObject.put("email",item.getEmail());
// map.put("content",jsonObject.toString()); // map.put("content",jsonObject.toString());
// historyMapper.saveLog(map); // historyMapper.saveLog(map);
historyService.setLog(HISTORYTYPE.ADMIN_INFO_DELETE, jsonObject); historyService.setLog(HISTORYTYPEDETAIL.ADMIN_INFO_DELETE, jsonObject);
} }
); );
log.info("deleteAdmin Deleted Admin: {}", map); log.info("deleteAdmin Deleted Admin: {}", map);

View File

@@ -3,7 +3,7 @@ package com.caliverse.admin.domain.service;
import com.caliverse.admin.domain.dao.admin.BattleMapper; import com.caliverse.admin.domain.dao.admin.BattleMapper;
import com.caliverse.admin.domain.datacomponent.MetaDataHandler; import com.caliverse.admin.domain.datacomponent.MetaDataHandler;
import com.caliverse.admin.domain.entity.BattleEvent; import com.caliverse.admin.domain.entity.BattleEvent;
import com.caliverse.admin.domain.entity.HISTORYTYPE; import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
import com.caliverse.admin.domain.entity.metadata.MetaBattleConfigData; import com.caliverse.admin.domain.entity.metadata.MetaBattleConfigData;
import com.caliverse.admin.domain.entity.metadata.MetaBattleRewardData; import com.caliverse.admin.domain.entity.metadata.MetaBattleRewardData;
import com.caliverse.admin.domain.request.BattleEventRequest; import com.caliverse.admin.domain.request.BattleEventRequest;
@@ -15,7 +15,7 @@ import com.caliverse.admin.global.common.code.SuccessCode;
import com.caliverse.admin.global.common.constants.CommonConstants; import com.caliverse.admin.global.common.constants.CommonConstants;
import com.caliverse.admin.global.common.constants.MysqlConstants; import com.caliverse.admin.global.common.constants.MysqlConstants;
import com.caliverse.admin.global.common.utils.CommonUtils; import com.caliverse.admin.global.common.utils.CommonUtils;
import com.caliverse.admin.history.service.MysqlHistoryLogService; import com.caliverse.admin.mongodb.service.MysqlHistoryLogService;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@@ -170,12 +170,10 @@ public class BattleEventService {
BattleEvent event_info = battleMapper.getBattleEventDetail(battle_event_id); BattleEvent event_info = battleMapper.getBattleEventDetail(battle_event_id);
mysqlHistoryLogService.insertHistoryLog( mysqlHistoryLogService.insertHistoryLog(
HISTORYTYPE.BATTLE_EVENT_ADD, HISTORYTYPEDETAIL.BATTLE_EVENT_ADD,
MysqlConstants.TABLE_NAME_BATTLE_EVENT, MysqlConstants.TABLE_NAME_BATTLE_EVENT,
HISTORYTYPE.BATTLE_EVENT_ADD.name(), HISTORYTYPEDETAIL.BATTLE_EVENT_ADD.name(),
event_info, event_info
CommonUtils.getAdmin().getEmail(),
CommonUtils.getClientIp()
); );
dynamodbBattleEventService.insertBattleEvent(battleEventRequest); dynamodbBattleEventService.insertBattleEvent(battleEventRequest);
@@ -234,13 +232,11 @@ public class BattleEventService {
BattleEvent after_info = battleMapper.getBattleEventDetail(id); BattleEvent after_info = battleMapper.getBattleEventDetail(id);
mysqlHistoryLogService.updateHistoryLog( mysqlHistoryLogService.updateHistoryLog(
HISTORYTYPE.BATTLE_EVENT_UPDATE, HISTORYTYPEDETAIL.BATTLE_EVENT_UPDATE,
MysqlConstants.TABLE_NAME_BATTLE_EVENT, MysqlConstants.TABLE_NAME_BATTLE_EVENT,
HISTORYTYPE.BATTLE_EVENT_UPDATE.name(), HISTORYTYPEDETAIL.BATTLE_EVENT_UPDATE.name(),
before_info, before_info,
after_info, after_info
CommonUtils.getAdmin().getEmail(),
CommonUtils.getClientIp()
); );
dynamodbBattleEventService.updateBattleEvent(battleEventRequest); dynamodbBattleEventService.updateBattleEvent(battleEventRequest);
@@ -277,13 +273,11 @@ public class BattleEventService {
} }
mysqlHistoryLogService.updateHistoryLog( mysqlHistoryLogService.updateHistoryLog(
HISTORYTYPE.BATTLE_EVENT_UPDATE, HISTORYTYPEDETAIL.BATTLE_EVENT_UPDATE,
MysqlConstants.TABLE_NAME_BATTLE_EVENT, MysqlConstants.TABLE_NAME_BATTLE_EVENT,
HISTORYTYPE.BATTLE_EVENT_UPDATE.name(), HISTORYTYPEDETAIL.BATTLE_EVENT_UPDATE.name(),
info, info,
battleMapper.getBattleEventDetail(id), battleMapper.getBattleEventDetail(id)
CommonUtils.getAdmin().getEmail(),
CommonUtils.getClientIp()
); );
dynamodbBattleEventService.updateStopBattleEvent(info); dynamodbBattleEventService.updateStopBattleEvent(info);
@@ -317,12 +311,10 @@ public class BattleEventService {
log.info("BattleEvent Delete Complete: {}", item); log.info("BattleEvent Delete Complete: {}", item);
mysqlHistoryLogService.deleteHistoryLog( mysqlHistoryLogService.deleteHistoryLog(
HISTORYTYPE.BATTLE_EVENT_DELETE, HISTORYTYPEDETAIL.BATTLE_EVENT_DELETE,
MysqlConstants.TABLE_NAME_BATTLE_EVENT, MysqlConstants.TABLE_NAME_BATTLE_EVENT,
HISTORYTYPE.BATTLE_EVENT_DELETE.name(), HISTORYTYPEDETAIL.BATTLE_EVENT_DELETE.name(),
info, info
CommonUtils.getAdmin().getEmail(),
CommonUtils.getClientIp()
); );
// dynamodbLandAuctionService.cancelLandAuction(auction_info); // dynamodbLandAuctionService.cancelLandAuction(auction_info);

View File

@@ -1,10 +1,9 @@
package com.caliverse.admin.domain.service; package com.caliverse.admin.domain.service;
import com.caliverse.admin.domain.dao.admin.BlackListMapper; import com.caliverse.admin.domain.dao.admin.BlackListMapper;
import com.caliverse.admin.domain.dao.admin.HistoryMapper;
import com.caliverse.admin.domain.entity.BlackList; import com.caliverse.admin.domain.entity.BlackList;
import com.caliverse.admin.domain.entity.Excel; import com.caliverse.admin.domain.entity.Excel;
import com.caliverse.admin.domain.entity.HISTORYTYPE; import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
import com.caliverse.admin.domain.request.BlackListRequest; import com.caliverse.admin.domain.request.BlackListRequest;
import com.caliverse.admin.domain.response.BlackListResponse; import com.caliverse.admin.domain.response.BlackListResponse;
import com.caliverse.admin.dynamodb.service.DynamodbUserService; import com.caliverse.admin.dynamodb.service.DynamodbUserService;
@@ -16,9 +15,8 @@ import com.caliverse.admin.global.common.constants.MysqlConstants;
import com.caliverse.admin.global.common.exception.RestApiException; import com.caliverse.admin.global.common.exception.RestApiException;
import com.caliverse.admin.global.common.utils.CommonUtils; import com.caliverse.admin.global.common.utils.CommonUtils;
import com.caliverse.admin.global.common.utils.ExcelUtils; import com.caliverse.admin.global.common.utils.ExcelUtils;
import com.caliverse.admin.history.service.MysqlHistoryLogService; import com.caliverse.admin.mongodb.service.MysqlHistoryLogService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.json.JSONObject;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
@@ -174,9 +172,9 @@ public class BlackListService {
BlackList info = blackListMapper.getBlackListDetail(blackListRequest.getId()); BlackList info = blackListMapper.getBlackListDetail(blackListRequest.getId());
mysqlHistoryLogService.insertHistoryLog( mysqlHistoryLogService.insertHistoryLog(
HISTORYTYPE.BLACKLIST_ADD, HISTORYTYPEDETAIL.BLACKLIST_ADD,
MysqlConstants.TABLE_NAME_USER_BLOCK, MysqlConstants.TABLE_NAME_USER_BLOCK,
HISTORYTYPE.BLACKLIST_ADD.name(), HISTORYTYPEDETAIL.BLACKLIST_ADD.name(),
info info
); );
} }
@@ -208,9 +206,9 @@ public class BlackListService {
BlackList info = blackListMapper.getBlackListDetail(blackListRequest.getId()); BlackList info = blackListMapper.getBlackListDetail(blackListRequest.getId());
mysqlHistoryLogService.insertHistoryLog( mysqlHistoryLogService.insertHistoryLog(
HISTORYTYPE.BLACKLIST_ADD, HISTORYTYPEDETAIL.BLACKLIST_ADD,
MysqlConstants.TABLE_NAME_USER_BLOCK, MysqlConstants.TABLE_NAME_USER_BLOCK,
HISTORYTYPE.BLACKLIST_ADD.name(), HISTORYTYPEDETAIL.BLACKLIST_ADD.name(),
info info
); );
} }
@@ -242,11 +240,12 @@ public class BlackListService {
logger.info("deleteBlackList delete: {}",map); logger.info("deleteBlackList delete: {}",map);
mysqlHistoryLogService.deleteHistoryLog( mysqlHistoryLogService.updateHistoryLog(
HISTORYTYPE.BLACKLIST_DELETE, HISTORYTYPEDETAIL.BLACKLIST_DELETE,
MysqlConstants.TABLE_NAME_USER_BLOCK, MysqlConstants.TABLE_NAME_USER_BLOCK,
HISTORYTYPE.BLACKLIST_DELETE.name(), HISTORYTYPEDETAIL.BLACKLIST_DELETE.name(),
blackList blackList,
blackListMapper.getBlackListDetail(id)
); );
if(dynamodbUserService.isBlockUser(blackList.getGuid())) if(dynamodbUserService.isBlockUser(blackList.getGuid()))

View File

@@ -17,7 +17,7 @@ import com.caliverse.admin.global.common.code.SuccessCode;
import com.caliverse.admin.global.common.constants.MysqlConstants; import com.caliverse.admin.global.common.constants.MysqlConstants;
import com.caliverse.admin.global.common.constants.Web3Constants; import com.caliverse.admin.global.common.constants.Web3Constants;
import com.caliverse.admin.global.common.utils.CommonUtils; import com.caliverse.admin.global.common.utils.CommonUtils;
import com.caliverse.admin.history.service.MysqlHistoryLogService; import com.caliverse.admin.mongodb.service.MysqlHistoryLogService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.json.JSONObject; import org.json.JSONObject;
@@ -147,12 +147,10 @@ public class CaliumService {
Calium calium = caliumMapper.getCaliumRequestDetail(caliumRequest.getId()); Calium calium = caliumMapper.getCaliumRequestDetail(caliumRequest.getId());
mysqlHistoryLogService.insertHistoryLog( mysqlHistoryLogService.insertHistoryLog(
HISTORYTYPE.CALIUM_ADD, HISTORYTYPEDETAIL.CALIUM_ADD,
MysqlConstants.TABLE_NAME_CALIUM_REQUEST, MysqlConstants.TABLE_NAME_CALIUM_REQUEST,
HISTORYTYPE.CALIUM_ADD.name(), HISTORYTYPEDETAIL.CALIUM_ADD.name(),
calium, calium
CommonUtils.getAdmin().getEmail(),
CommonUtils.getClientIp()
); );
//로그 기록 //로그 기록
@@ -160,7 +158,7 @@ public class CaliumService {
jsonObject.put("dept",caliumRequest.getDept()); jsonObject.put("dept",caliumRequest.getDept());
jsonObject.put("count",caliumRequest.getCount()); jsonObject.put("count",caliumRequest.getCount());
jsonObject.put("content",caliumRequest.getContent()); jsonObject.put("content",caliumRequest.getContent());
historyService.setLog(HISTORYTYPE.CALIUM_ADD, jsonObject); historyService.setLog(HISTORYTYPEDETAIL.CALIUM_ADD, jsonObject);
return CaliumResponse.builder() return CaliumResponse.builder()
.status(CommonCode.SUCCESS.getHttpStatus()) .status(CommonCode.SUCCESS.getHttpStatus())
@@ -195,7 +193,7 @@ public class CaliumService {
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
// jsonObject.put("dynamoDB_update",dynamoResult); // jsonObject.put("dynamoDB_update",dynamoResult);
historyService.setLog(HISTORYTYPE.CALIUM_TOTAL_UPDATE, jsonObject); historyService.setLog(HISTORYTYPEDETAIL.CALIUM_TOTAL_UPDATE, jsonObject);
return CaliumResponse.builder() return CaliumResponse.builder()
.status(CommonCode.SUCCESS.getHttpStatus()) .status(CommonCode.SUCCESS.getHttpStatus())

View File

@@ -3,7 +3,7 @@ package com.caliverse.admin.domain.service;
import com.caliverse.admin.domain.dao.admin.DataMapper; import com.caliverse.admin.domain.dao.admin.DataMapper;
import com.caliverse.admin.domain.dao.admin.LandMapper; import com.caliverse.admin.domain.dao.admin.LandMapper;
import com.caliverse.admin.domain.entity.*; import com.caliverse.admin.domain.entity.*;
import com.caliverse.admin.domain.request.AuthenticateRequest; import com.caliverse.admin.domain.request.DataRequest;
import com.caliverse.admin.domain.request.LogGenericRequest; import com.caliverse.admin.domain.request.LogGenericRequest;
import com.caliverse.admin.domain.response.DataResponse; import com.caliverse.admin.domain.response.DataResponse;
import com.caliverse.admin.dynamodb.service.DynamodbDataService; import com.caliverse.admin.dynamodb.service.DynamodbDataService;
@@ -12,10 +12,9 @@ import com.caliverse.admin.global.common.code.ErrorCode;
import com.caliverse.admin.global.common.code.SuccessCode; import com.caliverse.admin.global.common.code.SuccessCode;
import com.caliverse.admin.global.common.constants.MysqlConstants; import com.caliverse.admin.global.common.constants.MysqlConstants;
import com.caliverse.admin.global.common.utils.CommonUtils; import com.caliverse.admin.global.common.utils.CommonUtils;
import com.caliverse.admin.global.component.transaction.TransactionIdManager; import com.caliverse.admin.mongodb.domain.APILogInfo;
import com.caliverse.admin.history.domain.DynamodbDataInitializeHistory; import com.caliverse.admin.mongodb.service.DataInitializeHistoryService;
import com.caliverse.admin.history.service.DataInitializeHistoryService; import com.caliverse.admin.mongodb.service.MysqlHistoryLogService;
import com.caliverse.admin.history.service.MysqlHistoryLogService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.data.mongodb.UncategorizedMongoDbException; import org.springframework.data.mongodb.UncategorizedMongoDbException;
@@ -38,7 +37,7 @@ public class DataService {
private final LandMapper landMapper; private final LandMapper landMapper;
private final DataMapper dataMapper; private final DataMapper dataMapper;
private final DataInitializeHistoryService dataInitializeHistoryService; private final DataInitializeHistoryService dataInitializeHistoryService;
private final TransactionIdManager transactionIdManager;
public DataResponse initHistoryList(LogGenericRequest logGenericRequest){ public DataResponse initHistoryList(LogGenericRequest logGenericRequest){
@@ -48,9 +47,9 @@ public class DataService {
logGenericRequest.setStartDt(startDt); logGenericRequest.setStartDt(startDt);
logGenericRequest.setEndDt(endDt); logGenericRequest.setEndDt(endDt);
List<DynamodbDataInitializeHistory> logList = new ArrayList<>(); List<APILogInfo> logList = new ArrayList<>();
try{ try{
logList = dataInitializeHistoryService.loadHistoryData(logGenericRequest, DynamodbDataInitializeHistory.class); logList = dataInitializeHistoryService.loadHistoryData(logGenericRequest, APILogInfo.class);
}catch(UncategorizedMongoDbException e){ }catch(UncategorizedMongoDbException e){
if (e.getMessage().contains("Sort exceeded memory limit")) { if (e.getMessage().contains("Sort exceeded memory limit")) {
log.error("MongoDB Query memory limit error: {}", e.getMessage()); log.error("MongoDB Query memory limit error: {}", e.getMessage());
@@ -80,11 +79,19 @@ public class DataService {
} }
@Transactional(transactionManager = "transactionManager") @Transactional(transactionManager = "transactionManager")
public DataResponse initData(AuthenticateRequest authenticateRequest){ public DataResponse initData(DataRequest dataRequest){
EInitDataType dataType = authenticateRequest.getInitDataType(); EInitDataType dataType = dataRequest.getInitDataType();
dataRequest.setCreateBy(CommonUtils.getAdmin().getId());
log.info("initData email: {}, initDataType: {}", CommonUtils.getAdmin().getEmail(), dataType); log.info("initData email: {}, initDataType: {}", CommonUtils.getAdmin().getEmail(), dataType);
dataMapper.postDataInit(dataType, CommonUtils.getAdmin().getId()); dataMapper.postDataInit(dataRequest);
mysqlHistoryLogService.insertHistoryLog(
HISTORYTYPEDETAIL.DATA_INIT_ADD,
MysqlConstants.TABLE_NAME_DATA_INIT,
HISTORYTYPEDETAIL.DATA_INIT_ADD.name(),
dataMapper.getDataInitDetail(dataRequest.getId())
);
// switch(dataType){ // switch(dataType){
// case LandAuction -> { // case LandAuction -> {
@@ -130,30 +137,25 @@ public class DataService {
landMapper.deleteMessage(map); landMapper.deleteMessage(map);
mysqlHistoryLogService.deleteHistoryLog( mysqlHistoryLogService.deleteHistoryLog(
HISTORYTYPE.LAND_AUCTION_INITIALIZE, HISTORYTYPEDETAIL.LAND_AUCTION_INITIALIZE,
MysqlConstants.TABLE_NAME_LAND_AUCTION, MysqlConstants.TABLE_NAME_LAND_AUCTION,
HISTORYTYPE.LAND_AUCTION_INITIALIZE.name(), HISTORYTYPEDETAIL.LAND_AUCTION_INITIALIZE.name(),
landAuction, landAuction
CommonUtils.getAdmin() == null ? "" : CommonUtils.getAdmin().getEmail(),
CommonUtils.getClientIp() == null ? "" : CommonUtils.getClientIp()
); );
if (!message.isEmpty()) { if (!message.isEmpty()) {
mysqlHistoryLogService.deleteHistoryLog( mysqlHistoryLogService.deleteHistoryLog(
HISTORYTYPE.LAND_AUCTION_INITIALIZE, HISTORYTYPEDETAIL.LAND_AUCTION_INITIALIZE,
MysqlConstants.TABLE_NAME_MESSAGE, MysqlConstants.TABLE_NAME_MESSAGE,
HISTORYTYPE.LAND_AUCTION_INITIALIZE.name(), HISTORYTYPEDETAIL.LAND_AUCTION_INITIALIZE.name(),
message, message
CommonUtils.getAdmin() == null ? "" : CommonUtils.getAdmin().getEmail(),
CommonUtils.getClientIp() == null ? "" : CommonUtils.getClientIp()
); );
} }
dataInitializeHistoryService.mysqlDataInitHistory( dataInitializeHistoryService.mysqlDataInitHistory(
EInitDataType.LandAuction, EInitDataType.LandAuction,
MysqlConstants.TABLE_NAME_LAND_AUCTION, MysqlConstants.TABLE_NAME_LAND_AUCTION,
transactionIdManager.getCurrentTransactionId(),
true, true,
"", "SUCCESS",
landAuction landAuction
); );
@@ -162,7 +164,6 @@ public class DataService {
dataInitializeHistoryService.mysqlDataInitHistory( dataInitializeHistoryService.mysqlDataInitHistory(
EInitDataType.LandAuction, EInitDataType.LandAuction,
MysqlConstants.TABLE_NAME_LAND_AUCTION, MysqlConstants.TABLE_NAME_LAND_AUCTION,
transactionIdManager.getCurrentTransactionId(),
false, false,
e.getMessage(), e.getMessage(),
landAuction landAuction
@@ -176,20 +177,17 @@ public class DataService {
landMapper.initLandOwnedChanges(id); landMapper.initLandOwnedChanges(id);
mysqlHistoryLogService.deleteHistoryLog( mysqlHistoryLogService.deleteHistoryLog(
HISTORYTYPE.LAND_OWNED_INITIALIZE, HISTORYTYPEDETAIL.LAND_OWNED_INITIALIZE,
MysqlConstants.TABLE_NAME_LAND_OWNER_CHANGE, MysqlConstants.TABLE_NAME_LAND_OWNER_CHANGE,
HISTORYTYPE.LAND_OWNED_INITIALIZE.name(), HISTORYTYPEDETAIL.LAND_OWNED_INITIALIZE.name(),
landOwnerChange, landOwnerChange
CommonUtils.getAdmin() == null ? "" : CommonUtils.getAdmin().getEmail(),
CommonUtils.getClientIp() == null ? "" : CommonUtils.getClientIp()
); );
dataInitializeHistoryService.mysqlDataInitHistory( dataInitializeHistoryService.mysqlDataInitHistory(
EInitDataType.LandOwned, EInitDataType.LandOwned,
MysqlConstants.TABLE_NAME_LAND_OWNER_CHANGE, MysqlConstants.TABLE_NAME_LAND_OWNER_CHANGE,
transactionIdManager.getCurrentTransactionId(),
true, true,
"", "SUCCESS",
landOwnerChange landOwnerChange
); );
}catch(Exception e){ }catch(Exception e){
@@ -197,7 +195,6 @@ public class DataService {
dataInitializeHistoryService.mysqlDataInitHistory( dataInitializeHistoryService.mysqlDataInitHistory(
EInitDataType.LandOwned, EInitDataType.LandOwned,
MysqlConstants.TABLE_NAME_LAND_OWNER_CHANGE, MysqlConstants.TABLE_NAME_LAND_OWNER_CHANGE,
transactionIdManager.getCurrentTransactionId(),
false, false,
e.getMessage(), e.getMessage(),
landOwnerChange landOwnerChange

View File

@@ -90,11 +90,11 @@ public class DynamoDBService {
} }
// guid check // guid check
public boolean isGuidChecked(String guid) { // public boolean isGuidChecked(String guid) {
Map<String, AttributeValue> item = getItem("user_base#"+guid,"empty"); // Map<String, AttributeValue> item = getItem("user_base#"+guid,"empty");
//
return item.isEmpty(); // return item.isEmpty();
} // }
// public Map<String, Object> getAccountInfo(String guid){ // public Map<String, Object> getAccountInfo(String guid){
@@ -274,125 +274,6 @@ public class DynamoDBService {
}); });
} }
public boolean isWhiteOrBlackUser(String accountId){
String key = "PK = :pkValue";
Map<String, AttributeValue> values = Map.of(":pkValue", AttributeValue.builder().s("account_base#"+accountId).build());
AtomicBoolean isFlag = new AtomicBoolean(false);
excuteItems(executeQuery(key, values), "AccountBaseAttrib")
.forEach(attrMap -> {
String[] blockPolicy = CommonUtils.objectToStringArray(attrMap.get("block_policy"));
if(Arrays.stream(blockPolicy).findAny().isEmpty()){
isFlag.set(false);
}else{
isFlag.set(true);
}
});
return isFlag.get();
// if (attributeValue == null || attributeValue.s() == null) {
// // 속성 값이 없거나 문자열이 아닌 경우에 대한 처리
// return false;
// }
//
// // 속성 값을 문자열로 가져옴
// String isFlag = attributeValue.s();
//
// // "true" 문자열과 대소문자 구분 없이 비교하여 boolean 값으로 반환
// return isFlag.equalsIgnoreCase("true");
// if(attr == null) return false;
}
// 닉네임 변경
public void updateNickname(String guid,String nickname,String newNickname){
try{
// char#guid 에서 CharInfo-> DisplayName 변경
updateCharInfo(guid, newNickname);
// nickname#xxx 에서 Attr-> AccountId 변경
createNewNickName(guid,newNickname);
// 기존 nickname 항목 삭제 처리
deleteNickname(nickname);
}catch (Exception e){
log.error("updateNickname: {}", e.getMessage());
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage() );
}
}
public void updateCharInfo(String guid, String newNickname) throws JsonProcessingException {
// 기존 CharInfo 값 가져오기
Map<String, AttributeValue> item = getItem("char#" + guid, "char#" + guid);
String charInfoJson = item.get("CharInfo").s();
// CharInfo JSON 문자열을 파싱
ObjectMapper objectMapper = new ObjectMapper();
JsonNode charInfoNode = objectMapper.readTree(charInfoJson);
// 원하는 속성 변경
((ObjectNode) charInfoNode).put("DisplayName", newNickname);
// 변경된 CharInfo JSON 문자열
String updatedCharInfoJson = charInfoNode.toString();
// 업데이트할 내용을 정의
Map<String, AttributeValue> expressionAttributeValues = new HashMap<>();
expressionAttributeValues.put(":newNickName", AttributeValue.builder().s(updatedCharInfoJson).build());
// 업데이트 표현식을 정의
String updateExpression = "SET CharInfo = :newNickName";
// 업데이트 요청 생성
UpdateItemRequest updateRequest = UpdateItemRequest.builder()
.tableName(metaTable)
.key(Map.of(
"PK", AttributeValue.builder().s("char#" + guid).build(),
"SK", AttributeValue.builder().s("char#" + guid).build()))
.updateExpression(updateExpression)
.expressionAttributeValues(expressionAttributeValues)
.returnValues(ReturnValue.ALL_NEW) // 업데이트 후의 값을 반환하려면 지정
.build();
dynamoDbClient.updateItem(updateRequest);
}
public void createNewNickName(String guid, String newNickname) {
String attrJson = String.format("{\"AccountGuid\":\"%s\",\"AccountId\":\"%s\"}", guid, newNickname);
Map<String, AttributeValue> itemAttributes = new HashMap<>();
itemAttributes.put("PK", AttributeValue.builder().s("user_nickname_registry#global").build());
itemAttributes.put("SK", AttributeValue.builder().s(newNickname).build());
itemAttributes.put("Attr", AttributeValue.builder().s(attrJson).build());
itemAttributes.put("Type", AttributeValue.builder().s("NickName").build());
PutItemRequest item = PutItemRequest.builder()
.tableName(metaTable)
.item(itemAttributes)
.build();
dynamoDbClient.putItem(item);
}
public void deleteNickname(String nickname) {
Map<String, AttributeValue> itemAttributes = new HashMap<>();
itemAttributes.put("PK", AttributeValue.builder().s("nickname#" + nickname).build());
itemAttributes.put("SK", AttributeValue.builder().s("nickname#").build());
DeleteItemRequest request = DeleteItemRequest.builder()
.tableName(metaTable)
.key(itemAttributes)
.build();
dynamoDbClient.deleteItem(request);
}
//신고 내역 조회 //신고 내역 조회
public List<UserReportResponse.Report> getUserReportList(Map<String,String> requestParam) { public List<UserReportResponse.Report> getUserReportList(Map<String,String> requestParam) {
@@ -708,63 +589,6 @@ public class DynamoDBService {
dynamoDbClient.updateItem(item); dynamoDbClient.updateItem(item);
} }
//아이템 내역 조회
// public List<ItemList> getItems(String guid){
// List<ItemList> list = new ArrayList<>();
//
// String key = "PK = :pkValue";
// Map<String, AttributeValue> values = Map.of(":pkValue", AttributeValue.builder().s("item#"+guid).build());
//
//// QueryRequest queryRequest = QueryRequest.builder()
//// .tableName(metaTable)
//// .keyConditionExpression("PK = :pkValue") // 파티션 키와 조건식 설정
//// .expressionAttributeValues(Map.of(":pkValue", AttributeValue.builder().s("item#"+guid).build()))
//// .build();
//
// try {
// // 쿼리 실행
// QueryResponse response = executeQuery(key, values);
//
// int row = 1;
// // 응답에서 원하는 속성을 가져옵니다.
// for (Map<String, AttributeValue> item : response.items()) {
// AttributeValue attrValue = item.get("ItemAttrib");
// if (attrValue != null) {
// // "Attr" 속성의 값을 읽어옵니다.
// String attrJson = attrValue.s();
//
// // JSON 문자열을 파싱하여 Map 또는 다른 객체로 변환합니다.
// ObjectMapper objectMapper = new ObjectMapper();
// Map<String, Object> attrMap = objectMapper.readValue(attrJson, new TypeReference<Map<String, Object>>() {
// });
//
// String item_nm = metaDataHandler.getMetaItemNameData(CommonUtils.objectToInteger(attrMap.get("item_meta_id")));
// ItemList itemInfo = ItemList.builder()
// .rowNum((long) row)
// .guid(guid)
// .itemId(attrMap.get("item_meta_id").toString())
// .itemName(metaDataHandler.getTextStringData(item_nm))
// .status(ItemList.STATUS.PERMITTED)
// .restoreType("")
// .createBy(item.get("CreatedDateTime").s()).build();
//
// list.add(itemInfo);
//
// row++;
// }
// }
// log.info("getItems Response ItemInfo: {}", list);
// }
// catch (JsonProcessingException jpe){
// log.error("getItems JsonProcessingException: {}", jpe.getMessage());
// throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
// }catch (Exception e){
// log.error("getItems: {}", e.getMessage());
// throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
// }
// return list;
// }
//아이템 - 의상 조회 //아이템 - 의상 조회
public Map<String, Object> getCloth(String guid){ public Map<String, Object> getCloth(String guid){
Map<String, Object> resultMap = new HashMap<>(); Map<String, Object> resultMap = new HashMap<>();
@@ -868,184 +692,25 @@ public class DynamoDBService {
return resultMap; return resultMap;
} }
//아이템 - 인벤토리 조회
public UsersResponse.InventoryInfo getInvenItems(String guid){
String key = "PK = :pkValue";
Map<String, AttributeValue> values = Map.of(":pkValue", AttributeValue.builder().s("item#"+guid).build());
List<UsersResponse.Item> clothList = new ArrayList<>();
List<UsersResponse.Item> propList = new ArrayList<>();
List<UsersResponse.Item> beautyList = new ArrayList<>();
List<UsersResponse.Item> tattooList = new ArrayList<>();
List<UsersResponse.Item> currencyList = new ArrayList<>();
List<UsersResponse.Item> etcList = new ArrayList<>();
try {
excuteItems(executeQuery(key, values), "ItemAttrib")
.filter(attrMap -> attrMap.containsKey("equiped_inven_type") && (int) attrMap.get("equiped_inven_type") == 0)
.forEach(attrMap -> {
int item_id = (int) attrMap.get("item_meta_id");
String item_nm = metaDataHandler.getTextStringData(metaDataHandler.getMetaItemNameData(item_id));
String item_type = metaDataHandler.getMetaItemLargeTypeData(item_id);
UsersResponse.Item inventory = UsersResponse.Item.builder()
.itemId(item_id)
.itemName(item_nm)
.count(CommonUtils.objectToInteger(attrMap.get("item_stack_count")))
.itemGuid(CommonUtils.objectToString(attrMap.get("item_guid")))
.build();
if(item_type.isEmpty()) {
etcList.add(inventory);
}else{
switch (ITEMLARGETYPE.valueOf(item_type)){
case CLOTH -> clothList.add(inventory);
case PROP -> propList.add(inventory);
case BEAUTY -> beautyList.add(inventory);
case TATTOO -> tattooList.add(inventory);
case CURRENCY -> currencyList.add(inventory);
default -> etcList.add(inventory);
}}
});
log.info("getInvenItems Response cloth: {}, prop: {}, beauty: {}, tattoo: {}, currency: {}, etc: {}", clothList, propList, beautyList, tattooList, currencyList, etcList);
return UsersResponse.InventoryInfo.builder()
.cloth(clothList)
.prop(propList)
.beauty(beautyList)
.tattoo(tattooList)
.currency(currencyList)
.etc(etcList)
.build();
}catch (Exception e){
log.error("getInvenItems: {}", e.getMessage());
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
}
}
// 유저 조회 - 우편 삭제 // 유저 조회 - 우편 삭제
public String deleteMail(String type, String guid, String mail_guid) { // public String deleteMail(String type, String guid, String mail_guid) {
Map<String, AttributeValue> itemAttributes = new HashMap<>();
if(type.equals("SEND")){
itemAttributes.put("PK", AttributeValue.builder().s("sent_mail#" + guid).build());
}else{
itemAttributes.put("PK", AttributeValue.builder().s("recv_mail#" + guid).build());
}
itemAttributes.put("SK", AttributeValue.builder().s(mail_guid).build());
try {
Map<String, AttributeValue> item = null;
if(type.equals("SEND")){
item = getItem("sent_mail#" + guid, mail_guid);
log.info("deleteMail PK: {}, SK: {}", "sent_mail#" + guid, mail_guid);
}else{
item = getItem("recv_mail#" + guid, mail_guid);
log.info("deleteMail PK: {}, SK: {}", "recv_mail#" + guid, mail_guid);
}
DeleteItemRequest request = DeleteItemRequest.builder()
.tableName(metaTable)
.key(itemAttributes)
.build();
DeleteItemResponse response = dynamoDbClient.deleteItem(request);
if(response.sdkHttpResponse().isSuccessful())
return item.toString();
return "";
}catch (ConditionalCheckFailedException e) {
log.error("deleteUsersMail Conditional check failed: {}", e.getMessage());
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
}catch(Exception e){
log.error("deleteUsersMail: {}", e.getMessage());
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
}
}
// 유저 조회 - 우편 아이템 삭제
public JSONObject updateMailItem(String type, String guid, String mail_guid, Long itemId, double count, double newCount) {
try {
Map<String, AttributeValue> item = null;
Map<String, AttributeValue> key = new HashMap<>();
if(type.equals("SEND")){
item = getItem("sent_mail#" + guid, mail_guid);
key = Map.of("PK", AttributeValue.builder().s("sent_mail#" + guid).build(),"SK", AttributeValue.builder().s(mail_guid).build());
}else{
item = getItem("recv_mail#" + guid, mail_guid);
key = Map.of("PK", AttributeValue.builder().s("recv_mail#" + guid).build(),"SK", AttributeValue.builder().s(mail_guid).build());
}
String InfoJson = item.get("MailAttrib").s();
ObjectMapper objectMapper = new ObjectMapper();
JsonNode infoNode = objectMapper.readTree(InfoJson);
log.info("updateMailItem Before updatedInfoJson: {}", infoNode.toString());
ArrayNode itemListNode = (ArrayNode) infoNode.get("item_list");
// Java 17 스타일의 IntStream을 사용하여 itemId를 찾고 처리
OptionalInt indexOpt = IntStream.range(0, itemListNode.size())
.filter(i -> itemListNode.get(i).get("ItemId").asInt() == itemId)
.findFirst();
if (indexOpt.isEmpty()) {
log.error("updateMailItem mail item not found");
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
}
int index = indexOpt.getAsInt();
JsonNode itemNode = itemListNode.get(index);
if (count > newCount) {
// count 수정
((ObjectNode) itemNode).put("Count", count - newCount);
} else {
// item 삭제
itemListNode.remove(index);
}
String updatedInfoJson = infoNode.toString();
log.info("updateMailItem Tobe updatedInfoJson: {}", updatedInfoJson);
Map<String, AttributeValue> expressionAttributeValues = new HashMap<>();
expressionAttributeValues.put(":newAttrib", AttributeValue.builder().s(updatedInfoJson).build());
String updateExpression = "SET MailAttrib = :newAttrib";
UpdateItemRequest updateRequest = UpdateItemRequest.builder()
.tableName(metaTable)
.key(key)
.updateExpression(updateExpression)
.expressionAttributeValues(expressionAttributeValues)
.returnValues(ReturnValue.ALL_NEW) // 업데이트 후의 값을 반환하려면 지정
.build();
dynamoDbClient.updateItem(updateRequest);
JSONObject jsonObject = new JSONObject();
jsonObject.put("data(before)", InfoJson);
jsonObject.put("data(after)", updatedInfoJson);
return jsonObject;
}catch (ConditionalCheckFailedException e) {
log.error("deleteUsersMail Conditional check failed: {}", e.getMessage());
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
}catch(Exception e){
log.error("deleteUsersMail: {}", e.getMessage());
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
}
}
// 아이템 삭제
// public String deleteItem(String guid, String item_guid) {
// Map<String, AttributeValue> itemAttributes = new HashMap<>(); // Map<String, AttributeValue> itemAttributes = new HashMap<>();
// itemAttributes.put("PK", AttributeValue.builder().s("item#" + guid).build()); // if(type.equals("SEND")){
// itemAttributes.put("SK", AttributeValue.builder().s(item_guid).build()); // itemAttributes.put("PK", AttributeValue.builder().s("sent_mail#" + guid).build());
// }else{
// itemAttributes.put("PK", AttributeValue.builder().s("recv_mail#" + guid).build());
// }
// itemAttributes.put("SK", AttributeValue.builder().s(mail_guid).build());
// try { // try {
// Map<String, AttributeValue> item = getItem("item#" + guid, item_guid); // Map<String, AttributeValue> item = null;
// log.info("deleteItem PK: {}, SK: {}", "item#" + guid, item_guid); // if(type.equals("SEND")){
// item = getItem("sent_mail#" + guid, mail_guid);
// log.info("deleteMail PK: {}, SK: {}", "sent_mail#" + guid, mail_guid);
// }else{
// item = getItem("recv_mail#" + guid, mail_guid);
// log.info("deleteMail PK: {}, SK: {}", "recv_mail#" + guid, mail_guid);
// }
// //
// DeleteItemRequest request = DeleteItemRequest.builder() // DeleteItemRequest request = DeleteItemRequest.builder()
// .tableName(metaTable) // .tableName(metaTable)
@@ -1059,41 +724,67 @@ public class DynamoDBService {
// //
// return ""; // return "";
// }catch (ConditionalCheckFailedException e) { // }catch (ConditionalCheckFailedException e) {
// log.error("deleteItem Conditional check failed: {}", e.getMessage()); // log.error("deleteUsersMail Conditional check failed: {}", e.getMessage());
// throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage()); // throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
// }catch(Exception e){ // }catch(Exception e){
// log.error("deleteItem: {}", e.getMessage()); // log.error("deleteUsersMail: {}", e.getMessage());
// throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage()); // throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
// } // }
// } // }
// 아이템 정보 수정 // 유저 조회 - 우편 아이템 삭제
// public JSONObject updateItem(String guid, String item_guid, int cnt) { // public JSONObject updateMailItem(String type, String guid, String mail_guid, Long itemId, double count, double newCount) {
// try{ // try {
// Map<String, AttributeValue> item = null;
// Map<String, AttributeValue> key = new HashMap<>();
// if(type.equals("SEND")){
// item = getItem("sent_mail#" + guid, mail_guid);
// key = Map.of("PK", AttributeValue.builder().s("sent_mail#" + guid).build(),"SK", AttributeValue.builder().s(mail_guid).build());
// }else{
// item = getItem("recv_mail#" + guid, mail_guid);
// key = Map.of("PK", AttributeValue.builder().s("recv_mail#" + guid).build(),"SK", AttributeValue.builder().s(mail_guid).build());
// }
// //
// Map<String, AttributeValue> item = getItem("item#" + guid, item_guid); // String InfoJson = item.get("MailAttrib").s();
//
// String InfoJson = item.get("ItemAttrib").s();
// //
// ObjectMapper objectMapper = new ObjectMapper(); // ObjectMapper objectMapper = new ObjectMapper();
// JsonNode infoNode = objectMapper.readTree(InfoJson); // JsonNode infoNode = objectMapper.readTree(InfoJson);
// log.info("updateItem Before UpdateInfo : {}", infoNode.toString()); // log.info("updateMailItem Before updatedInfoJson: {}", infoNode.toString());
// //
// ((ObjectNode) infoNode).put("item_stack_count", cnt); // ArrayNode itemListNode = (ArrayNode) infoNode.get("item_list");
//
// // Java 17 스타일의 IntStream을 사용하여 itemId를 찾고 처리
// OptionalInt indexOpt = IntStream.range(0, itemListNode.size())
// .filter(i -> itemListNode.get(i).get("ItemId").asInt() == itemId)
// .findFirst();
//
// if (indexOpt.isEmpty()) {
// log.error("updateMailItem mail item not found");
// throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
// }
//
// int index = indexOpt.getAsInt();
// JsonNode itemNode = itemListNode.get(index);
//
// if (count > newCount) {
// // count 수정
// ((ObjectNode) itemNode).put("Count", count - newCount);
// } else {
// // item 삭제
// itemListNode.remove(index);
// }
// //
// String updatedInfoJson = infoNode.toString(); // String updatedInfoJson = infoNode.toString();
// log.info("updateItem Tobe UpdateInfo : {}", updatedInfoJson); // log.info("updateMailItem Tobe updatedInfoJson: {}", updatedInfoJson);
// //
// Map<String, AttributeValue> expressionAttributeValues = new HashMap<>(); // Map<String, AttributeValue> expressionAttributeValues = new HashMap<>();
// expressionAttributeValues.put(":newAttrib", AttributeValue.builder().s(updatedInfoJson).build()); // expressionAttributeValues.put(":newAttrib", AttributeValue.builder().s(updatedInfoJson).build());
// //
// String updateExpression = "SET ItemAttrib = :newAttrib"; // String updateExpression = "SET MailAttrib = :newAttrib";
// //
// UpdateItemRequest updateRequest = UpdateItemRequest.builder() // UpdateItemRequest updateRequest = UpdateItemRequest.builder()
// .tableName(metaTable) // .tableName(metaTable)
// .key(Map.of( // .key(key)
// "PK", AttributeValue.builder().s("item#" + guid).build(),
// "SK", AttributeValue.builder().s(item_guid).build()))
// .updateExpression(updateExpression) // .updateExpression(updateExpression)
// .expressionAttributeValues(expressionAttributeValues) // .expressionAttributeValues(expressionAttributeValues)
// .returnValues(ReturnValue.ALL_NEW) // 업데이트 후의 값을 반환하려면 지정 // .returnValues(ReturnValue.ALL_NEW) // 업데이트 후의 값을 반환하려면 지정
@@ -1106,9 +797,12 @@ public class DynamoDBService {
// jsonObject.put("data(before)", InfoJson); // jsonObject.put("data(before)", InfoJson);
// jsonObject.put("data(after)", updatedInfoJson); // jsonObject.put("data(after)", updatedInfoJson);
// return jsonObject; // return jsonObject;
// }catch (ConditionalCheckFailedException e) {
// log.error("deleteUsersMail Conditional check failed: {}", e.getMessage());
// throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
// }catch(Exception e){ // }catch(Exception e){
// log.error("updateItem: {}", e.getMessage()); // log.error("deleteUsersMail: {}", e.getMessage());
// throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage() ); // throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
// } // }
// } // }

View File

@@ -5,14 +5,14 @@ import com.caliverse.admin.domain.datacomponent.MetaDataHandler;
import com.caliverse.admin.domain.entity.*; import com.caliverse.admin.domain.entity.*;
import com.caliverse.admin.domain.request.EventRequest; import com.caliverse.admin.domain.request.EventRequest;
import com.caliverse.admin.domain.response.EventResponse; 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.dynamodb.service.DynamodbService;
import com.caliverse.admin.global.common.code.CommonCode; import com.caliverse.admin.global.common.code.CommonCode;
import com.caliverse.admin.global.common.code.ErrorCode; import com.caliverse.admin.global.common.code.ErrorCode;
import com.caliverse.admin.global.common.code.SuccessCode; import com.caliverse.admin.global.common.code.SuccessCode;
import com.caliverse.admin.global.common.constants.MysqlConstants; import com.caliverse.admin.global.common.constants.MysqlConstants;
import com.caliverse.admin.global.common.utils.CommonUtils; import com.caliverse.admin.global.common.utils.CommonUtils;
import com.caliverse.admin.history.service.MysqlHistoryLogService; import com.caliverse.admin.mongodb.service.MysqlHistoryLogService;
import com.fasterxml.jackson.databind.node.ArrayNode;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.json.JSONObject; import org.json.JSONObject;
@@ -30,6 +30,7 @@ import java.util.Map;
public class EventService { public class EventService {
private final DynamoDBService dynamoDBService; private final DynamoDBService dynamoDBService;
private final DynamodbService dynamodbService; private final DynamodbService dynamodbService;
private final DynamodbMailService dynamodbMailService;
private final EventMapper eventMapper; private final EventMapper eventMapper;
private final MetaDataHandler metaDataHandler; private final MetaDataHandler metaDataHandler;
@@ -120,23 +121,12 @@ public class EventService {
Event event = eventMapper.getEventDetail(event_id); Event event = eventMapper.getEventDetail(event_id);
mysqlHistoryLogService.insertHistoryLog( mysqlHistoryLogService.insertHistoryLog(
HISTORYTYPE.EVENT_ADD, HISTORYTYPEDETAIL.EVENT_ADD,
MysqlConstants.TABLE_NAME_EVENT, MysqlConstants.TABLE_NAME_EVENT,
HISTORYTYPE.EVENT_ADD.name(), HISTORYTYPEDETAIL.EVENT_ADD.name(),
event, event
CommonUtils.getAdmin().getEmail(),
CommonUtils.getClientIp()
); );
//로그 기록
JSONObject jsonObject = new JSONObject();
jsonObject.put("type",eventRequest.getEventType());
jsonObject.put("start_dt",eventRequest.getStartDt());
jsonObject.put("end_dt",eventRequest.getEndDt());
jsonObject.put("mail_list",map);
historyService.setLog(HISTORYTYPE.EVENT_ADD, jsonObject);
return EventResponse.builder() return EventResponse.builder()
.status(CommonCode.SUCCESS.getHttpStatus()) .status(CommonCode.SUCCESS.getHttpStatus())
.result(CommonCode.SUCCESS.getResult()) .result(CommonCode.SUCCESS.getResult())
@@ -197,61 +187,13 @@ public class EventService {
after_event.setItemList(eventMapper.getItem(event_id)); after_event.setItemList(eventMapper.getItem(event_id));
mysqlHistoryLogService.updateHistoryLog( mysqlHistoryLogService.updateHistoryLog(
HISTORYTYPE.EVENT_UPDATE, HISTORYTYPEDETAIL.EVENT_UPDATE,
MysqlConstants.TABLE_NAME_EVENT, MysqlConstants.TABLE_NAME_EVENT,
HISTORYTYPE.EVENT_UPDATE.name(), HISTORYTYPEDETAIL.EVENT_UPDATE.name(),
before_info, before_info,
after_event, after_event
CommonUtils.getAdmin().getEmail(),
CommonUtils.getClientIp()
); );
JSONObject jsonObject = new JSONObject();
// if(result == 1){
// ObjectMapper objectMapper = new ObjectMapper();
// ArrayNode mailTitleArray = objectMapper.createArrayNode();
// ArrayNode mailTextArray = objectMapper.createArrayNode();
// ArrayNode mailItemArray = objectMapper.createArrayNode();
// for(Item item : eventRequest.getItemList()){
// MailItem mailItem = MailItem.newBuilder().setItemId(CommonUtils.stringToInt(item.getItem())).setCount(item.getItemCnt()).build();
// mailItemArray.add(JsonUtils.createMAilItem(mailItem));
// }
// for(Message msg: eventRequest.getMailList()){
// String langText = msg.getLanguage();
// int lang;
//
// if(langText.equals(LANGUAGETYPE.EN.toString())){
// lang = LanguageType.LanguageType_en.getNumber();
// }else if(langText.equals(LANGUAGETYPE.JA.toString())){
// lang = LanguageType.LanguageType_ja.getNumber();
// }else{
// lang = LanguageType.LanguageType_ko.getNumber();
// }
// SystemMessage titleMessage = SystemMessage.builder().LanguageType(lang).Text(msg.getTitle()).build();
// SystemMessage textMessage = SystemMessage.builder().LanguageType(lang).Text(msg.getContent()).build();
//
// mailTitleArray.add(JsonUtils.createSystemMessage(titleMessage));
// mailTextArray.add(JsonUtils.createSystemMessage(textMessage));
// }
//
// String dynamoResult = dynamoDBService.updateSystemMail(
// event_id.toString(),
// mailTitleArray,
// mailTextArray,
// eventRequest.getStartDt(),
// eventRequest.getEndDt(),
// mailItemArray);
// jsonObject.put("dynamoDB_update",dynamoResult);
// log.info("updateEvent DynamoDB Update Complete: {}", dynamoResult);
// }
//로그 기록
jsonObject.put("before_event",before_info.toString());
jsonObject.put("type",eventRequest.getEventType());
jsonObject.put("start_dt",eventRequest.getStartDt());
jsonObject.put("end_dt",eventRequest.getEndDt());
historyService.setLog(HISTORYTYPE.EVENT_UPDATE, jsonObject);
return EventResponse.builder() return EventResponse.builder()
.status(CommonCode.SUCCESS.getHttpStatus()) .status(CommonCode.SUCCESS.getHttpStatus())
.result(CommonCode.SUCCESS.getResult()) .result(CommonCode.SUCCESS.getResult())
@@ -278,12 +220,10 @@ public class EventService {
log.info("updateEvent AdminTool Delete Complete: {}", eventRequest); log.info("updateEvent AdminTool Delete Complete: {}", eventRequest);
mysqlHistoryLogService.deleteHistoryLog( mysqlHistoryLogService.deleteHistoryLog(
HISTORYTYPE.EVENT_DELETE, HISTORYTYPEDETAIL.EVENT_DELETE,
MysqlConstants.TABLE_NAME_EVENT, MysqlConstants.TABLE_NAME_EVENT,
HISTORYTYPE.EVENT_DELETE.name(), HISTORYTYPEDETAIL.EVENT_DELETE.name(),
event, event
CommonUtils.getAdmin().getEmail(),
CommonUtils.getClientIp()
); );
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
@@ -298,7 +238,7 @@ public class EventService {
if(!message.isEmpty()){ if(!message.isEmpty()){
jsonObject.put("message",message.get(0).getTitle()); jsonObject.put("message",message.get(0).getTitle());
} }
historyService.setLog(HISTORYTYPE.EVENT_DELETE, jsonObject); historyService.setLog(HISTORYTYPEDETAIL.EVENT_DELETE, jsonObject);
} }
); );
@@ -365,7 +305,7 @@ public class EventService {
event.setMailList(eventMapper.getMessage(event_id)); event.setMailList(eventMapper.getMessage(event_id));
event.setItemList(eventMapper.getItem(event_id)); event.setItemList(eventMapper.getItem(event_id));
dynamodbService.insertSystemMail(event); dynamodbMailService.insertSystemMail(event);
eventMapper.updateAddFlag(event_id); eventMapper.updateAddFlag(event_id);
updateEventStatus(event_id, Event.EVENTSTATUS.RUNNING); updateEventStatus(event_id, Event.EVENTSTATUS.RUNNING);

View File

@@ -137,7 +137,7 @@ public class GroupService {
map.put("adminId", CommonUtils.getAdmin().getId()); map.put("adminId", CommonUtils.getAdmin().getId());
map.put("name", CommonUtils.getAdmin().getName()); map.put("name", CommonUtils.getAdmin().getName());
map.put("mail", CommonUtils.getAdmin().getEmail()); map.put("mail", CommonUtils.getAdmin().getEmail());
map.put("type", HISTORYTYPE.GROUP_AUTH_UPDATE); map.put("type", HISTORYTYPEDETAIL.GROUP_AUTH_UPDATE);
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put("groupNm",groupMapper.getGroupInfo(Long.valueOf(groupId)).get("name")); jsonObject.put("groupNm",groupMapper.getGroupInfo(Long.valueOf(groupId)).get("name"));
jsonObject.put("auth(before)",beforeAuth); jsonObject.put("auth(before)",beforeAuth);
@@ -168,7 +168,7 @@ public class GroupService {
map.put("adminId", CommonUtils.getAdmin().getId()); map.put("adminId", CommonUtils.getAdmin().getId());
map.put("name", CommonUtils.getAdmin().getName()); map.put("name", CommonUtils.getAdmin().getName());
map.put("mail", CommonUtils.getAdmin().getEmail()); map.put("mail", CommonUtils.getAdmin().getEmail());
map.put("type", HISTORYTYPE.GROUP_DELETE); map.put("type", HISTORYTYPEDETAIL.GROUP_DELETE);
map.put("content",jsonObject.toString()); map.put("content",jsonObject.toString());
historyMapper.saveLog(map); historyMapper.saveLog(map);
} }

View File

@@ -1,13 +1,18 @@
package com.caliverse.admin.domain.service; package com.caliverse.admin.domain.service;
import com.caliverse.admin.domain.entity.HISTORYTYPE; import com.caliverse.admin.domain.dao.admin.AdminMapper;
import com.caliverse.admin.domain.entity.Log; 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.dao.admin.HistoryMapper;
import com.caliverse.admin.domain.request.HistoryRequest;
import com.caliverse.admin.domain.response.HistoryResponse; import com.caliverse.admin.domain.response.HistoryResponse;
import com.caliverse.admin.global.common.code.CommonCode; import com.caliverse.admin.global.common.code.CommonCode;
import com.caliverse.admin.global.common.code.ErrorCode;
import com.caliverse.admin.global.common.utils.CommonUtils; import com.caliverse.admin.global.common.utils.CommonUtils;
import io.jsonwebtoken.io.IOException; import com.caliverse.admin.global.common.utils.DateUtils;
import com.caliverse.admin.mongodb.domain.HistoryLogInfoBase;
import com.caliverse.admin.mongodb.service.HistoryLogService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@@ -15,42 +20,84 @@ import org.apache.commons.io.FileUtils;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.io.File; import java.io.File;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.time.LocalDateTime;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional;
@Service @Service
@RequiredArgsConstructor @RequiredArgsConstructor
@Slf4j @Slf4j
public class HistoryService { public class HistoryService {
private final AdminMapper adminMapper;
private final HistoryMapper historyMapper; private final HistoryMapper historyMapper;
private final HistoryLogService historyLogService;
public HistoryResponse getHistoryList(Map requestParams){ public HistoryResponse getHistoryList(Map requestParams){
//페이징 처리 //페이징 처리
requestParams = CommonUtils.pageSetting(requestParams); requestParams = CommonUtils.pageSetting(requestParams);
String searchType = requestParams.get("searchType").toString();
String searchData = requestParams.get("searchData").toString();
HISTORYTYPEDETAIL historyType = requestParams.get("historyType").equals("") ? null : HISTORYTYPEDETAIL.valueOf(requestParams.get("historyType").toString());
LocalDateTime startDt = requestParams.get("startDate").equals("") ? null : DateUtils.stringISOToLocalDateTime(requestParams.get("startDate").toString());
LocalDateTime endDt = requestParams.get("endDate").equals("") ? null : DateUtils.stringISOToLocalDateTime(requestParams.get("endDate").toString());
List<Log> historyList = historyMapper.getHistoryList(requestParams); // List<Log> historyList = historyMapper.getHistoryList(requestParams);
HistoryRequest historyRequest = new HistoryRequest();
historyRequest.setHistoryType(historyType);
historyRequest.setStartDt(startDt);
historyRequest.setEndDt(endDt);
if(searchType.equals("NAME")){
Optional<Admin> admin = adminMapper.findByEmail(searchData);
if(admin.isPresent()){
historyRequest.setUserMail(searchData);
}else{
return HistoryResponse.builder()
.resultData(HistoryResponse.ResultData.builder()
.message(ErrorCode.NOT_USER.toString())
.build())
.status(CommonCode.ERROR.getHttpStatus())
.result(CommonCode.ERROR.getResult())
.build();
}
}else{
historyRequest.setUserMail(searchData);
}
List<HistoryLogInfoBase> historyList = historyLogService.loadHistoryData(historyRequest, HistoryLogInfoBase.class);
int allCnt = historyMapper.getAllCnt(requestParams); int allCnt = historyMapper.getAllCnt(requestParams);
return HistoryResponse.builder() return HistoryResponse.builder()
.resultData(HistoryResponse.ResultData.builder() .resultData(HistoryResponse.ResultData.builder()
.total(historyMapper.getTotal()) .list(historyList)
.totalAll(allCnt) .build())
.pageNo(requestParams.get("page_no")!=null?
Integer.valueOf(requestParams.get("page_no").toString()):1)
.list(historyList).build())
.status(CommonCode.SUCCESS.getHttpStatus()) .status(CommonCode.SUCCESS.getHttpStatus())
.result(CommonCode.SUCCESS.getResult()) .result(CommonCode.SUCCESS.getResult())
.build(); .build();
} }
public HistoryResponse getHistory(HistoryRequest historyRequest){
List<HistoryLogInfoBase> historyList = historyLogService.loadHistoryData(historyRequest, HistoryLogInfoBase.class);
return HistoryResponse.builder()
.resultData(HistoryResponse.ResultData.builder()
.list(historyList)
.build())
.status(CommonCode.SUCCESS.getHttpStatus())
.result(CommonCode.SUCCESS.getResult())
.build();
}
public HistoryResponse getHistoryDetail(String id){ public HistoryResponse getHistoryDetail(String id){
String logJson = historyMapper.getLogJson(id); String logJson = historyMapper.getLogJson(id);
return HistoryResponse.builder() return HistoryResponse.builder()
@@ -100,7 +147,7 @@ public class HistoryService {
} }
} }
public void setLog(HISTORYTYPE type, JSONObject content){ public void setLog(HISTORYTYPEDETAIL type, JSONObject content){
//로그 기록 //로그 기록
Map<String, Object> logMap = new HashMap<>(); Map<String, Object> logMap = new HashMap<>();
logMap.put("adminId", CommonUtils.getAdmin().getId()); logMap.put("adminId", CommonUtils.getAdmin().getId());
@@ -111,7 +158,7 @@ public class HistoryService {
historyMapper.saveLog(logMap); historyMapper.saveLog(logMap);
} }
public void setScheduleLog(HISTORYTYPE type, String message){ public void setScheduleLog(HISTORYTYPEDETAIL type, String message){
//스케줄 로그 기록 //스케줄 로그 기록
Map<String, Object> logMap = new HashMap<>(); Map<String, Object> logMap = new HashMap<>();
logMap.put("adminId", 1); logMap.put("adminId", 1);

View File

@@ -68,7 +68,7 @@ public class ItemsService {
ItemsResponse.Item item = ItemsResponse.Item.builder() ItemsResponse.Item item = ItemsResponse.Item.builder()
.userGuid(finalGuid) .userGuid(finalGuid)
.itemGuid(attrib.getItemGuid()) .itemGuid(attrib.getItemGuid())
.id(itemId) .id(attrib.getItemGuid())
.itemId(itemId) .itemId(itemId)
.itemName(metaDataHandler.getTextStringData(metaDataHandler.getMetaItemNameData(itemId))) .itemName(metaDataHandler.getTextStringData(metaDataHandler.getMetaItemNameData(itemId)))
.count(attrib.getItemStackCount()) .count(attrib.getItemStackCount())

View File

@@ -23,7 +23,7 @@ import com.caliverse.admin.global.common.constants.CommonConstants;
import com.caliverse.admin.global.common.constants.MysqlConstants; import com.caliverse.admin.global.common.constants.MysqlConstants;
import com.caliverse.admin.global.common.utils.CommonUtils; import com.caliverse.admin.global.common.utils.CommonUtils;
import com.caliverse.admin.global.common.utils.DateUtils; import com.caliverse.admin.global.common.utils.DateUtils;
import com.caliverse.admin.history.service.MysqlHistoryLogService; import com.caliverse.admin.mongodb.service.MysqlHistoryLogService;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@@ -417,12 +417,10 @@ public class LandService {
auction_info.setMessageList(landMapper.getMessage(auction_id)); auction_info.setMessageList(landMapper.getMessage(auction_id));
mysqlHistoryLogService.insertHistoryLog( mysqlHistoryLogService.insertHistoryLog(
HISTORYTYPE.LAND_AUCTION_ADD, HISTORYTYPEDETAIL.LAND_AUCTION_ADD,
MysqlConstants.TABLE_NAME_LAND_AUCTION, MysqlConstants.TABLE_NAME_LAND_AUCTION,
HISTORYTYPE.LAND_AUCTION_ADD.name(), HISTORYTYPEDETAIL.LAND_AUCTION_ADD.name(),
auction_info, auction_info
CommonUtils.getAdmin().getEmail(),
CommonUtils.getClientIp()
); );
dynamodbLandAuctionService.insertLandAuctionRegistryWithActivity(landRequest); dynamodbLandAuctionService.insertLandAuctionRegistryWithActivity(landRequest);
@@ -485,12 +483,10 @@ public class LandService {
LandOwnerChange info = landMapper.getLandOwnerChangeDetail(id); LandOwnerChange info = landMapper.getLandOwnerChangeDetail(id);
mysqlHistoryLogService.insertHistoryLog( mysqlHistoryLogService.insertHistoryLog(
HISTORYTYPE.LAND_OWNER_CHANGE_ADD, HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_ADD,
MysqlConstants.TABLE_NAME_LAND_OWNER_CHANGE, MysqlConstants.TABLE_NAME_LAND_OWNER_CHANGE,
HISTORYTYPE.LAND_OWNER_CHANGE_ADD.name(), HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_ADD.name(),
info, info
CommonUtils.getAdmin().getEmail(),
CommonUtils.getClientIp()
); );
// if(!is_reserve){ // if(!is_reserve){
@@ -547,16 +543,14 @@ public class LandService {
// log.info("AdminToolDB Message Update Complete"); // log.info("AdminToolDB Message Update Complete");
LandAuction after_info = landMapper.getLandAuctionDetail(id); LandAuction after_info = landMapper.getLandAuctionDetail(id);
after_info.setMessageList(landMapper.getMessage(id)); // after_info.setMessageList(landMapper.getMessage(id));
mysqlHistoryLogService.updateHistoryLog( mysqlHistoryLogService.updateHistoryLog(
HISTORYTYPE.LAND_AUCTION_UPDATE, HISTORYTYPEDETAIL.LAND_AUCTION_UPDATE,
MysqlConstants.TABLE_NAME_LAND_AUCTION, MysqlConstants.TABLE_NAME_LAND_AUCTION,
HISTORYTYPE.LAND_AUCTION_UPDATE.name(), HISTORYTYPEDETAIL.LAND_AUCTION_UPDATE.name(),
before_info, before_info,
after_info, after_info
CommonUtils.getAdmin().getEmail(),
CommonUtils.getClientIp()
); );
dynamodbLandAuctionService.updateLandAuction(landRequest); dynamodbLandAuctionService.updateLandAuction(landRequest);
@@ -587,13 +581,11 @@ public class LandService {
LandOwnerChange after_info = landMapper.getLandOwnerChangeDetail(id); LandOwnerChange after_info = landMapper.getLandOwnerChangeDetail(id);
mysqlHistoryLogService.updateHistoryLog( mysqlHistoryLogService.updateHistoryLog(
HISTORYTYPE.LAND_OWNER_CHANGE_UPDATE, HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_UPDATE,
MysqlConstants.TABLE_NAME_LAND_OWNER_CHANGE, MysqlConstants.TABLE_NAME_LAND_OWNER_CHANGE,
HISTORYTYPE.LAND_OWNER_CHANGE_UPDATE.name(), HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_UPDATE.name(),
before_info, before_info,
after_info, after_info
CommonUtils.getAdmin().getEmail(),
CommonUtils.getClientIp()
); );
dynamodbLandService.ChangesLandOwner(landRequest); dynamodbLandService.ChangesLandOwner(landRequest);
@@ -628,12 +620,10 @@ public class LandService {
log.info("LandAuction Delete Complete: {}", item); log.info("LandAuction Delete Complete: {}", item);
mysqlHistoryLogService.deleteHistoryLog( mysqlHistoryLogService.deleteHistoryLog(
HISTORYTYPE.LAND_AUCTION_DELETE, HISTORYTYPEDETAIL.LAND_AUCTION_DELETE,
MysqlConstants.TABLE_NAME_LAND_AUCTION, MysqlConstants.TABLE_NAME_LAND_AUCTION,
HISTORYTYPE.LAND_AUCTION_DELETE.name(), HISTORYTYPEDETAIL.LAND_AUCTION_DELETE.name(),
auction_info, auction_info
CommonUtils.getAdmin().getEmail(),
CommonUtils.getClientIp()
); );
dynamodbLandAuctionService.cancelLandAuction(auction_info); dynamodbLandAuctionService.cancelLandAuction(auction_info);
@@ -647,7 +637,7 @@ public class LandService {
} }
jsonObject.put("auction_info", auction_info); jsonObject.put("auction_info", auction_info);
// jsonObject.put("dynamoDB_result",land_auction_registry_result); // jsonObject.put("dynamoDB_result",land_auction_registry_result);
historyService.setLog(HISTORYTYPE.LAND_AUCTION_DELETE, jsonObject); historyService.setLog(HISTORYTYPEDETAIL.LAND_AUCTION_DELETE, jsonObject);
} }
); );
@@ -686,12 +676,10 @@ public class LandService {
log.info("LandOwnerChanges Delete Complete: {}", landRequest); log.info("LandOwnerChanges Delete Complete: {}", landRequest);
mysqlHistoryLogService.deleteHistoryLog( mysqlHistoryLogService.deleteHistoryLog(
HISTORYTYPE.LAND_OWNER_CHANGE_DELETE, HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_DELETE,
MysqlConstants.TABLE_NAME_LAND_OWNER_CHANGE, MysqlConstants.TABLE_NAME_LAND_OWNER_CHANGE,
HISTORYTYPE.LAND_OWNER_CHANGE_DELETE.name(), HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_DELETE.name(),
info, info
CommonUtils.getAdmin().getEmail(),
CommonUtils.getClientIp()
); );
return LandResponse.builder() return LandResponse.builder()

View File

@@ -41,7 +41,13 @@ public class LogService {
.status(CommonCode.ERROR.getHttpStatus()) .status(CommonCode.ERROR.getHttpStatus())
.result(ErrorCode.ERROR_LOG_MEMORY_LIMIT.toString()) .result(ErrorCode.ERROR_LOG_MEMORY_LIMIT.toString())
.build(); .build();
} else { } else if (e.getMessage().contains("time limit")) {
log.error("MongoDB Query operation exceeded time limit: {}", e.getMessage());
return LogResponse.builder()
.status(CommonCode.ERROR.getHttpStatus())
.result(ErrorCode.ERROR_LOG_MEMORY_LIMIT.toString())
.build();
}else {
log.error("MongoDB Query error", e); log.error("MongoDB Query error", e);
return LogResponse.builder() return LogResponse.builder()
.status(CommonCode.ERROR.getHttpStatus()) .status(CommonCode.ERROR.getHttpStatus())

View File

@@ -13,13 +13,14 @@ import com.caliverse.admin.global.common.code.CommonCode;
import com.caliverse.admin.global.common.code.ErrorCode; import com.caliverse.admin.global.common.code.ErrorCode;
import com.caliverse.admin.global.common.code.SuccessCode; import com.caliverse.admin.global.common.code.SuccessCode;
import com.caliverse.admin.global.common.constants.CommonConstants; import com.caliverse.admin.global.common.constants.CommonConstants;
import com.caliverse.admin.global.common.constants.MysqlConstants;
import com.caliverse.admin.global.common.exception.RestApiException; import com.caliverse.admin.global.common.exception.RestApiException;
import com.caliverse.admin.global.common.utils.CommonUtils; import com.caliverse.admin.global.common.utils.CommonUtils;
import com.caliverse.admin.global.common.utils.ExcelUtils; import com.caliverse.admin.global.common.utils.ExcelUtils;
import com.caliverse.admin.mongodb.service.MysqlHistoryLogService;
import com.caliverse.admin.scheduler.ScheduleService; import com.caliverse.admin.scheduler.ScheduleService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource; import org.springframework.core.io.Resource;
import org.springframework.core.io.UrlResource; import org.springframework.core.io.UrlResource;
@@ -53,6 +54,7 @@ public class MailService {
private final ScheduleService scheduleService; private final ScheduleService scheduleService;
private final HistoryService historyService; private final HistoryService historyService;
private final DynamodbCaliumService dynamodbCaliumService; private final DynamodbCaliumService dynamodbCaliumService;
private final MysqlHistoryLogService mysqlHistoryLogService;
public MailResponse getStockCalium(){ public MailResponse getStockCalium(){
double stock_calium = dynamodbCaliumService.getCaliumTotal(); double stock_calium = dynamodbCaliumService.getCaliumTotal();
@@ -153,7 +155,7 @@ public class MailService {
public Resource excelDown(String fileName) { public Resource excelDown(String fileName) {
Path filePath = Path.of(excelPath+fileName); Path filePath = Path.of(excelPath+fileName);
try { try {
if(fileName.contains("sample")){ if(fileName.contains("_sample")){
return resourceLoader.getResource(samplePath + fileName); return resourceLoader.getResource(samplePath + fileName);
} }
Resource resource = new UrlResource(filePath.toUri()); Resource resource = new UrlResource(filePath.toUri());
@@ -180,16 +182,15 @@ public class MailService {
//단일일경우 guid 를 target 설정, 복수이면은 fileName을 target에 설정 //단일일경우 guid 를 target 설정, 복수이면은 fileName을 target에 설정
if(mailRequest.getGuid() != null){ if(mailRequest.getGuid() != null){
if(mailRequest.getUserType().equals(Mail.USERTYPE.GUID) && dynamoDBService.isGuidChecked(mailRequest.getGuid())){ if(mailRequest.getUserType().equals(Mail.USERTYPE.GUID) && !dynamodbUserService.isUser(mailRequest.getGuid())){
log.error("postMail RECEIVETYPE Single Guid Find Fail"); log.error("postMail RECEIVETYPE Single Guid Find Fail");
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.WARNING_GUID_CHECK.getMessage()); throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.WARNING_GUID_CHECK.getMessage());
} }
String guid = mailRequest.getGuid(); String guid = mailRequest.getGuid();
// 닉네임이면 guid로 바꾼다 // 닉네임이면 guid로 바꾼다
if(mailRequest.getUserType().equals(Mail.USERTYPE.NICKNAME)) { if(mailRequest.getUserType().equals(Mail.USERTYPE.NICKNAME)) {
// guid = dynamoDBService.getNickNameByGuid(guid);
guid = getGuid(guid, Mail.USERTYPE.NICKNAME.name()); guid = getGuid(guid, Mail.USERTYPE.NICKNAME.name());
if(guid == null || mailRequest.getGuid().equals(guid)){ if(guid == null || guid.isEmpty() || mailRequest.getGuid().equals(guid)){
log.error("postMail RECEIVETYPE Single Nickname Find Fail"); log.error("postMail RECEIVETYPE Single Nickname Find Fail");
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.NICKNAME_CHECK.getMessage() ); throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.NICKNAME_CHECK.getMessage() );
} }
@@ -213,7 +214,7 @@ public class MailService {
for(Excel excel : excelList){ for(Excel excel : excelList){
switch (excel.getType()) { switch (excel.getType()) {
case "GUID" -> { case "GUID" -> {
if (dynamoDBService.isGuidChecked(excel.getUser())) { if (!dynamodbUserService.isUser(excel.getUser())) {
log.error("postMail Multi Guid({}) Find Fail", excel.getUser()); log.error("postMail Multi Guid({}) Find Fail", excel.getUser());
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.WARNING_GUID_CHECK.toString()); throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.WARNING_GUID_CHECK.toString());
} }
@@ -241,7 +242,6 @@ public class MailService {
mailMapper.postMail(mailRequest); mailMapper.postMail(mailRequest);
//log.info("mail_id::"+ mailRequest.getId());
HashMap<String,String> map = new HashMap<>(); HashMap<String,String> map = new HashMap<>();
map.put("mailId",String.valueOf(mailRequest.getId())); map.put("mailId",String.valueOf(mailRequest.getId()));
@@ -289,16 +289,16 @@ public class MailService {
} }
log.info("postMail Insert Mail: {}", mailRequest); log.info("postMail Insert Mail: {}", mailRequest);
//로그 기록 Mail info = mailMapper.getMailDetail(mailRequest.getId());
JSONObject jsonObject = new JSONObject(); info.setMailList(mailMapper.getMessage(mailRequest.getId()));
jsonObject.put("mail_type",mailRequest.getMailType()); info.setItemList(mailMapper.getItem(mailRequest.getId()));
jsonObject.put("receiver",mailRequest.getTarget());
Mail.SENDTYPE sendType = mailRequest.getSendType(); mysqlHistoryLogService.insertHistoryLog(
jsonObject.put("send_type",sendType); HISTORYTYPEDETAIL.MAIL_ADD,
if(sendType.equals(Mail.SENDTYPE.RESERVE_SEND)) MysqlConstants.TABLE_NAME_MAIL,
jsonObject.put("send_dt",mailRequest.getSendDt()); HISTORYTYPEDETAIL.MAIL_ADD.name(),
jsonObject.put("mail_list",map); info
historyService.setLog(HISTORYTYPE.MAIL_ADD, jsonObject); );
return MailResponse.builder() return MailResponse.builder()
.status(CommonCode.SUCCESS.getHttpStatus()) .status(CommonCode.SUCCESS.getHttpStatus())
@@ -339,10 +339,10 @@ public class MailService {
Long mail_id = mailRequest.getId(); Long mail_id = mailRequest.getId();
Mail before_info = mailMapper.getMailDetail(mail_id); Mail before_info = mailMapper.getMailDetail(mail_id);
List<Message> before_msg = mailMapper.getMessage(mail_id); before_info.setMailList(mailMapper.getMessage(mail_id));
List<Item> before_item = mailMapper.getItem(mail_id); before_info.setItemList(mailMapper.getItem(mail_id));
log.info("updateMail Update Before MailInfo: {}, Message: {}, Item: {}", before_info, before_msg, before_item); log.info("updateMail Update Before MailInfo: {}", before_info);
mailMapper.updateMail(mailRequest); mailMapper.updateMail(mailRequest);
@@ -380,18 +380,28 @@ public class MailService {
} }
log.info("updateMail Update After Mail: {}", mailRequest); log.info("updateMail Update After Mail: {}", mailRequest);
Mail after_info = mailMapper.getMailDetail(mail_id);
after_info.setMailList(mailMapper.getMessage(mail_id));
after_info.setItemList(mailMapper.getItem(mail_id));
mysqlHistoryLogService.updateHistoryLog(
HISTORYTYPEDETAIL.MAIL_UPDATE,
MysqlConstants.TABLE_NAME_MAIL,
HISTORYTYPEDETAIL.MAIL_UPDATE.name(),
before_info,
after_info
);
//로그 기록 //로그 기록
JSONObject jsonObject = new JSONObject(); // JSONObject jsonObject = new JSONObject();
jsonObject.put("before_info",before_info.toString()); // jsonObject.put("before_info",before_info.toString());
jsonObject.put("before_msg",before_msg.toString()); // jsonObject.put("mail_type",mailRequest.getMailType());
jsonObject.put("before_item",before_item.toString()); // jsonObject.put("receiver",mailRequest.getTarget());
jsonObject.put("mail_type",mailRequest.getMailType()); // Mail.SENDTYPE sendType = mailRequest.getSendType();
jsonObject.put("receiver",mailRequest.getTarget()); // jsonObject.put("send_type",sendType);
Mail.SENDTYPE sendType = mailRequest.getSendType(); // if(sendType.equals(Mail.SENDTYPE.RESERVE_SEND))
jsonObject.put("send_type",sendType); // jsonObject.put("send_dt",mailRequest.getSendDt());
if(sendType.equals(Mail.SENDTYPE.RESERVE_SEND)) // historyService.setLog(HISTORYTYPE.MAIL_UPDATE, jsonObject);
jsonObject.put("send_dt",mailRequest.getSendDt());
historyService.setLog(HISTORYTYPE.MAIL_UPDATE, jsonObject);
return MailResponse.builder() return MailResponse.builder()
.status(CommonCode.SUCCESS.getHttpStatus()) .status(CommonCode.SUCCESS.getHttpStatus())
@@ -408,25 +418,36 @@ public class MailService {
mailRequest.getList().forEach( mailRequest.getList().forEach(
item->{ item->{
map.put("id",item.getId()); long id = item.getId();
Mail info = mailMapper.getMailDetail(id);
map.put("id",id);
mailMapper.deleteMail(map); mailMapper.deleteMail(map);
// 스케줄에서 제거 // 스케줄에서 제거
scheduleService.closeTask("mail-" + item.getId()); scheduleService.closeTask("mail-" + item.getId());
log.info("deleteMail Mail: {}", item); 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())); // List<Message> message = mailMapper.getMessage(Long.valueOf(item.getId()));
map.put("adminId", CommonUtils.getAdmin().getId()); // map.put("adminId", CommonUtils.getAdmin().getId());
map.put("name", CommonUtils.getAdmin().getName()); // map.put("name", CommonUtils.getAdmin().getName());
map.put("mail", CommonUtils.getAdmin().getEmail()); // map.put("mail", CommonUtils.getAdmin().getEmail());
map.put("type", HISTORYTYPE.MAIL_DELETE); // map.put("type", HISTORYTYPE.MAIL_DELETE);
JSONObject jsonObject = new JSONObject(); // JSONObject jsonObject = new JSONObject();
if(!message.isEmpty()){ // if(!message.isEmpty()){
jsonObject.put("message",message.get(0).getTitle()); // jsonObject.put("message",message.get(0).getTitle());
} // }
map.put("content",jsonObject.toString()); // map.put("content",jsonObject.toString());
historyMapper.saveLog(map); // historyMapper.saveLog(map);
} }
); );
@@ -495,7 +516,7 @@ public class MailService {
return target; return target;
} }
public void setScheduleLog(HISTORYTYPE type, String message){ public void setScheduleLog(HISTORYTYPEDETAIL type, String message){
//스케줄 로그 기록 //스케줄 로그 기록
historyService.setScheduleLog(type, message); historyService.setScheduleLog(type, message);
} }

View File

@@ -12,7 +12,7 @@ import com.caliverse.admin.global.common.constants.MysqlConstants;
import com.caliverse.admin.global.common.exception.RestApiException; import com.caliverse.admin.global.common.exception.RestApiException;
import com.caliverse.admin.global.common.utils.CommonUtils; import com.caliverse.admin.global.common.utils.CommonUtils;
import com.caliverse.admin.global.common.utils.FileUtils; import com.caliverse.admin.global.common.utils.FileUtils;
import com.caliverse.admin.history.service.MysqlHistoryLogService; import com.caliverse.admin.mongodb.service.MysqlHistoryLogService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
@@ -198,12 +198,10 @@ public class MenuService {
MenuBanner banner = menuMapper.getBannerDetail(menuRequest.getId()); MenuBanner banner = menuMapper.getBannerDetail(menuRequest.getId());
mysqlHistoryLogService.insertHistoryLog( mysqlHistoryLogService.insertHistoryLog(
HISTORYTYPE.MENU_BANNER_ADD, HISTORYTYPEDETAIL.MENU_BANNER_ADD,
MysqlConstants.TABLE_NAME_MENU_BANNER, MysqlConstants.TABLE_NAME_MENU_BANNER,
HISTORYTYPE.MENU_BANNER_ADD.name(), HISTORYTYPEDETAIL.MENU_BANNER_ADD.name(),
banner, banner
CommonUtils.getAdmin().getEmail(),
CommonUtils.getClientIp()
); );
return MenuResponse.builder() return MenuResponse.builder()
@@ -252,13 +250,11 @@ public class MenuService {
after_info.setImageList(menuMapper.getMessage(banner_id)); after_info.setImageList(menuMapper.getMessage(banner_id));
mysqlHistoryLogService.updateHistoryLog( mysqlHistoryLogService.updateHistoryLog(
HISTORYTYPE.MENU_BANNER_UPDATE, HISTORYTYPEDETAIL.MENU_BANNER_UPDATE,
MysqlConstants.TABLE_NAME_MENU_BANNER, MysqlConstants.TABLE_NAME_MENU_BANNER,
HISTORYTYPE.MENU_BANNER_UPDATE.name(), HISTORYTYPEDETAIL.MENU_BANNER_UPDATE.name(),
before_info, before_info,
after_info, after_info
CommonUtils.getAdmin().getEmail(),
CommonUtils.getClientIp()
); );
return MenuResponse.builder() return MenuResponse.builder()

View File

@@ -2,14 +2,16 @@ package com.caliverse.admin.domain.service;
import com.caliverse.admin.domain.dao.admin.HistoryMapper; import com.caliverse.admin.domain.dao.admin.HistoryMapper;
import com.caliverse.admin.domain.dao.admin.NoticeMapper; import com.caliverse.admin.domain.dao.admin.NoticeMapper;
import com.caliverse.admin.domain.entity.HISTORYTYPE; import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
import com.caliverse.admin.domain.entity.InGame; import com.caliverse.admin.domain.entity.InGame;
import com.caliverse.admin.domain.entity.Message; import com.caliverse.admin.domain.entity.Message;
import com.caliverse.admin.domain.request.NoticeRequest; import com.caliverse.admin.domain.request.NoticeRequest;
import com.caliverse.admin.domain.response.NoticeResponse; import com.caliverse.admin.domain.response.NoticeResponse;
import com.caliverse.admin.global.common.code.CommonCode; import com.caliverse.admin.global.common.code.CommonCode;
import com.caliverse.admin.global.common.code.SuccessCode; 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.common.utils.CommonUtils;
import com.caliverse.admin.mongodb.service.MysqlHistoryLogService;
import com.caliverse.admin.scheduler.ScheduleService; import com.caliverse.admin.scheduler.ScheduleService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@@ -31,6 +33,7 @@ public class NoticeService {
private final HistoryMapper historyMapper; private final HistoryMapper historyMapper;
private final ScheduleService scheduleService; private final ScheduleService scheduleService;
private final HistoryService historyService; private final HistoryService historyService;
private final MysqlHistoryLogService mysqlHistoryLogService;
public NoticeResponse getNoticeList(){ public NoticeResponse getNoticeList(){
@@ -95,16 +98,23 @@ public class NoticeService {
} }
log.info("postInGameMessage notice: {}", noticeRequest); log.info("postInGameMessage notice: {}", noticeRequest);
mysqlHistoryLogService.insertHistoryLog(
HISTORYTYPEDETAIL.NOTICE_ADD,
MysqlConstants.TABLE_NAME_NOTICE,
HISTORYTYPEDETAIL.NOTICE_ADD.name(),
noticeMapper.getNoticeDetail(noticeRequest.getId())
);
//로그 기록 //로그 기록
JSONObject jsonObject = new JSONObject(); // JSONObject jsonObject = new JSONObject();
jsonObject.put("message_type",noticeRequest.getMessageType()); // jsonObject.put("message_type",noticeRequest.getMessageType());
jsonObject.put("repeat_type",noticeRequest.getRepeatType()); // jsonObject.put("repeat_type",noticeRequest.getRepeatType());
jsonObject.put("repeat_cnt",noticeRequest.getRepeatCnt()); // jsonObject.put("repeat_cnt",noticeRequest.getRepeatCnt());
jsonObject.put("repeat_dt",noticeRequest.getRepeatDt()); // jsonObject.put("repeat_dt",noticeRequest.getRepeatDt());
jsonObject.put("send_dt",noticeRequest.getSendDt()); // jsonObject.put("send_dt",noticeRequest.getSendDt());
jsonObject.put("end_dt",noticeRequest.getEndDt()); // jsonObject.put("end_dt",noticeRequest.getEndDt());
jsonObject.put("message",noticeRequest.getGameMessages().toString()); // jsonObject.put("message",noticeRequest.getGameMessages().toString());
historyService.setLog(HISTORYTYPE.NOTICE_ADD, jsonObject); // historyService.setLog(HISTORYTYPE.NOTICE_ADD, jsonObject);
return NoticeResponse.builder() return NoticeResponse.builder()
.resultData(NoticeResponse.ResultData.builder().message(SuccessCode.REGISTRATION.getMessage()).build()) .resultData(NoticeResponse.ResultData.builder().message(SuccessCode.REGISTRATION.getMessage()).build())
@@ -117,6 +127,9 @@ public class NoticeService {
public NoticeResponse updateInGameMessage(Long id, NoticeRequest noticeRequest){ public NoticeResponse updateInGameMessage(Long id, NoticeRequest noticeRequest){
noticeRequest.setId(id); noticeRequest.setId(id);
noticeRequest.setUpdateBy(CommonUtils.getAdmin().getId()); noticeRequest.setUpdateBy(CommonUtils.getAdmin().getId());
InGame before_info = noticeMapper.getNoticeDetail(id);
int i = noticeMapper.updateNotice(noticeRequest); int i = noticeMapper.updateNotice(noticeRequest);
// 스케줄에서 기존 등록 제거 // 스케줄에서 기존 등록 제거
scheduleService.closeTask(noticeRequest.getId().toString()); scheduleService.closeTask(noticeRequest.getId().toString());
@@ -144,6 +157,14 @@ public class NoticeService {
} }
} }
log.info("updateInGameMessage After notice: {}", noticeRequest); log.info("updateInGameMessage After notice: {}", noticeRequest);
mysqlHistoryLogService.updateHistoryLog(
HISTORYTYPEDETAIL.NOTICE_UPDATE,
MysqlConstants.TABLE_NAME_NOTICE,
HISTORYTYPEDETAIL.NOTICE_UPDATE.name(),
before_info,
noticeMapper.getNoticeDetail(id)
);
return NoticeResponse.builder() return NoticeResponse.builder()
.resultData(NoticeResponse.ResultData.builder().message(SuccessCode.UPDATE.getMessage()).build()) .resultData(NoticeResponse.ResultData.builder().message(SuccessCode.UPDATE.getMessage()).build())
.result(CommonCode.SUCCESS.getResult()) .result(CommonCode.SUCCESS.getResult())
@@ -168,15 +189,22 @@ public class NoticeService {
log.info("deleteInGameMessage notice: {}", item); log.info("deleteInGameMessage notice: {}", item);
mysqlHistoryLogService.deleteHistoryLog(
HISTORYTYPEDETAIL.NOTICE_DELETE,
MysqlConstants.TABLE_NAME_NOTICE,
HISTORYTYPEDETAIL.NOTICE_DELETE.name(),
noticeMapper.getNoticeDetail(item.getMessageId())
);
//로그 기록 //로그 기록
map.put("adminId", CommonUtils.getAdmin().getId()); // map.put("adminId", CommonUtils.getAdmin().getId());
map.put("name", CommonUtils.getAdmin().getName()); // map.put("name", CommonUtils.getAdmin().getName());
map.put("mail", CommonUtils.getAdmin().getEmail()); // map.put("mail", CommonUtils.getAdmin().getEmail());
map.put("type", HISTORYTYPE.NOTICE_DELETE); // map.put("type", HISTORYTYPE.NOTICE_DELETE);
JSONObject jsonObject = new JSONObject(); // JSONObject jsonObject = new JSONObject();
jsonObject.put("message",message); // jsonObject.put("message",message);
map.put("content",jsonObject.toString()); // map.put("content",jsonObject.toString());
historyMapper.saveLog(map); // historyMapper.saveLog(map);
} }
); );
log.info("deleteInGameMessage notice: {}", noticeRequest); log.info("deleteInGameMessage notice: {}", noticeRequest);
@@ -206,7 +234,7 @@ public class NoticeService {
noticeMapper.updateCountNotice(id); noticeMapper.updateCountNotice(id);
} }
public void setScheduleLog(HISTORYTYPE type, String message){ public void setScheduleLog(HISTORYTYPEDETAIL type, String message){
//스케줄 로그 기록 //스케줄 로그 기록
Map<String, Object> logMap = new HashMap<>(); Map<String, Object> logMap = new HashMap<>();
logMap.put("adminId", 1); logMap.put("adminId", 1);

View File

@@ -8,7 +8,6 @@ import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.caliverse.admin.domain.entity.FriendRequest; import com.caliverse.admin.domain.entity.FriendRequest;
import com.caliverse.admin.domain.entity.HISTORYTYPE;
import com.caliverse.admin.domain.entity.SEARCHTYPE; import com.caliverse.admin.domain.entity.SEARCHTYPE;
import com.caliverse.admin.domain.request.MailRequest; import com.caliverse.admin.domain.request.MailRequest;
import com.caliverse.admin.dynamodb.domain.atrrib.AccountBaseAttrib; import com.caliverse.admin.dynamodb.domain.atrrib.AccountBaseAttrib;
@@ -18,17 +17,14 @@ import com.caliverse.admin.dynamodb.domain.atrrib.MoneyAttrib;
import com.caliverse.admin.dynamodb.domain.doc.MailDoc; import com.caliverse.admin.dynamodb.domain.doc.MailDoc;
import com.caliverse.admin.dynamodb.dto.PageResult; import com.caliverse.admin.dynamodb.dto.PageResult;
import com.caliverse.admin.dynamodb.service.DynamodbItemService; import com.caliverse.admin.dynamodb.service.DynamodbItemService;
import com.caliverse.admin.dynamodb.service.DynamodbMailService;
import com.caliverse.admin.dynamodb.service.DynamodbService; import com.caliverse.admin.dynamodb.service.DynamodbService;
import com.caliverse.admin.dynamodb.service.DynamodbUserService; import com.caliverse.admin.dynamodb.service.DynamodbUserService;
import com.caliverse.admin.global.common.utils.DynamodbUtil;
import com.caliverse.admin.redis.service.RedisUserInfoService; import com.caliverse.admin.redis.service.RedisUserInfoService;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.json.JSONObject;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.caliverse.admin.domain.datacomponent.MetaDataHandler; import com.caliverse.admin.domain.datacomponent.MetaDataHandler;
@@ -55,6 +51,7 @@ public class UsersService {
private final RedisUserInfoService redisUserInfoService; private final RedisUserInfoService redisUserInfoService;
private final DynamodbUserService dynamodbUserService; private final DynamodbUserService dynamodbUserService;
private final DynamodbItemService dynamodbItemService; private final DynamodbItemService dynamodbItemService;
private final DynamodbMailService dynamodbMailService;
@Autowired @Autowired
private MetaDataHandler metaDataHandler; private MetaDataHandler metaDataHandler;
@@ -154,6 +151,7 @@ public class UsersService {
.build(); .build();
} }
//유저 기본 정보
public UsersResponse getBasicInfo(String guid){ public UsersResponse getBasicInfo(String guid){
String account_id = dynamodbUserService.getGuidByAccountId(guid); String account_id = dynamodbUserService.getGuidByAccountId(guid);
@@ -200,6 +198,7 @@ public class UsersService {
} }
//아바타 정보
public UsersResponse getAvatarInfo(String guid){ public UsersResponse getAvatarInfo(String guid){
//avatarInfo //avatarInfo
@@ -217,10 +216,8 @@ public class UsersService {
} }
//의상 정보
public UsersResponse getClothInfo(String guid){ public UsersResponse getClothInfo(String guid){
//clothInfo
// Map<String, Object> charInfo = dynamoDBService.getClothInfo(guid);
Map<String, Object> charInfo = dynamoDBService.getCloth(guid); Map<String, Object> charInfo = dynamoDBService.getCloth(guid);
return UsersResponse.builder() return UsersResponse.builder()
@@ -235,10 +232,8 @@ public class UsersService {
} }
//도구 정보
public UsersResponse getToolSlotInfo(String guid){ public UsersResponse getToolSlotInfo(String guid){
// toolslotInfo
// List<UsersResponse.SlotInfo> toolSlot = dynamoDBService.getToolSlot(guid);
Map<String, Object> toolSlot = dynamoDBService.getTools(guid); Map<String, Object> toolSlot = dynamoDBService.getTools(guid);
return UsersResponse.builder() return UsersResponse.builder()
@@ -252,33 +247,9 @@ public class UsersService {
.build(); .build();
} }
public UsersResponse getInventoryInfo(String guid){
// List<List<UsersResponse.Inventory>> inventoryList = new ArrayList<>(); //인벤토리 정보
// List<List<String>> item = dynamoDBService.getInvenItems(guid); public UsersResponse getInventoryInfo(String guid){
// if(item != null){
// for (List<String> list : item){
// List<UsersResponse.Inventory> innerList = new ArrayList<>();
// for (String key : list){
// Map<String, Object> resItem = dynamoDBService.getItemTable(key);
//
// //객체를 생성하고 값을 설정
// UsersResponse.Inventory inventory = new UsersResponse.Inventory();
//
// Object itemId = resItem.get("ItemId");
// String itemIdString = CommonUtils.objectToString(itemId);
// Integer itemIdInteger = CommonUtils.objectToInteger(itemId);
//
//
// inventory.setCount(Integer.valueOf(CommonUtils.objectToString(resItem.get("Count"))));
// inventory.setItemId(itemIdString);
// inventory.setItemName(metaDataHandler.getMetaItemData(itemIdInteger).getName());
// innerList.add(inventory);
// }
// inventoryList.add(innerList);
// }
// }
// UsersResponse.InventoryInfo inventoryInfo = dynamoDBService.getInvenItems(guid);
UsersResponse.InventoryInfo inventoryInfo = dynamodbItemService.getInvenItems(guid); UsersResponse.InventoryInfo inventoryInfo = dynamodbItemService.getInvenItems(guid);
logger.info("getInventoryInfo Inventory Items: {}", inventoryInfo); logger.info("getInventoryInfo Inventory Items: {}", inventoryInfo);
@@ -294,6 +265,7 @@ public class UsersService {
} }
//인벤토리 아이템 삭제
public UsersResponse deleteInventoryItem(Map<String, String> requestParams){ public UsersResponse deleteInventoryItem(Map<String, String> requestParams){
String guid = requestParams.get("guid"); String guid = requestParams.get("guid");
String item_guid = requestParams.get("item_guid"); String item_guid = requestParams.get("item_guid");
@@ -302,12 +274,6 @@ public class UsersService {
userGameSessionService.kickUserSession(guid, "Item delete"); userGameSessionService.kickUserSession(guid, "Item delete");
if(update_cnt >= current_cnt){ if(update_cnt >= current_cnt){
// String attrib = dynamoDBService.deleteItem(guid, item_guid);
// if(!attrib.isEmpty()){
// JSONObject jsonObject = new JSONObject();
// jsonObject.put("data",attrib);
// historyService.setLog(HISTORYTYPE.INVENTORY_ITEM_DELETE, jsonObject);
// }
dynamodbItemService.deleteItem(guid, item_guid); dynamodbItemService.deleteItem(guid, item_guid);
return UsersResponse.builder() return UsersResponse.builder()
.status(CommonCode.SUCCESS.getHttpStatus()) .status(CommonCode.SUCCESS.getHttpStatus())
@@ -319,10 +285,6 @@ public class UsersService {
}else{ }else{
int cnt = current_cnt - update_cnt; int cnt = current_cnt - update_cnt;
dynamodbItemService.updateItemStack(guid, item_guid, cnt); dynamodbItemService.updateItemStack(guid, item_guid, cnt);
// JSONObject json = dynamoDBService.updateItem(guid, item_guid, cnt);
// if(!json.isEmpty()){
// historyService.setLog(HISTORYTYPE.INVENTORY_ITEM_UPDATE, json);
// }
return UsersResponse.builder() return UsersResponse.builder()
.status(CommonCode.SUCCESS.getHttpStatus()) .status(CommonCode.SUCCESS.getHttpStatus())
.result(CommonCode.SUCCESS.getResult()) .result(CommonCode.SUCCESS.getResult())
@@ -333,18 +295,17 @@ public class UsersService {
} }
} }
//우편 정보
public UsersResponse getMail(UsersRequest usersRequest){ public UsersResponse getMail(UsersRequest usersRequest){
// List<UsersResponse.Mail> mailList = dynamoDBService.getMail(guid, type); PageResult<MailDoc> mailPageResult = dynamodbMailService.getMail(usersRequest.getMailType(), usersRequest.getGuid(), "", usersRequest.getPageKey());
PageResult<MailDoc> mailPageResult = dynamodbService.getMail(usersRequest.getMailType(), usersRequest.getGuid(), "", usersRequest.getPageKey());
List<UsersResponse.Mail> mailList = new ArrayList<>(); List<UsersResponse.Mail> mailList = new ArrayList<>();
mailPageResult.getItems().forEach(doc -> { mailPageResult.getItems().forEach(doc -> {
try { try {
// MailAttrib attrib = objectMapper.readValue(doc.getAttribValue(), MailAttrib.class);
MailAttrib attrib = doc.getAttribValue(); MailAttrib attrib = doc.getAttribValue();
List<UsersResponse.MailItem> itemList = new ArrayList<>(); List<UsersResponse.MailItem> itemList = new ArrayList<>();
if(attrib == null){ if(attrib == null){
MailJsonAttrib mailJsonAttrib = dynamodbService.getMailJsonAttrib(doc.getPK(),doc.getSK()); MailJsonAttrib mailJsonAttrib = dynamodbMailService.getMailJsonAttrib(doc.getPK(),doc.getSK());
mailJsonAttrib.getItemList().forEach(item -> { mailJsonAttrib.getItemList().forEach(item -> {
UsersResponse.MailItem mailItem = new UsersResponse.MailItem(); UsersResponse.MailItem mailItem = new UsersResponse.MailItem();
mailItem.setItemId(CommonUtils.objectToString(item.getItemId())); mailItem.setItemId(CommonUtils.objectToString(item.getItemId()));
@@ -416,18 +377,14 @@ public class UsersService {
} }
//우편 삭제
public UsersResponse deleteMail(Map<String, String> requestParams){ public UsersResponse deleteMail(Map<String, String> requestParams){
String guid = requestParams.get("guid"); String guid = requestParams.get("guid");
String mail_guid = requestParams.get("mail_guid"); String mail_guid = requestParams.get("mail_guid");
String type = requestParams.get("type"); String type = requestParams.get("type");
userGameSessionService.kickUserSession(guid, "delete mail"); userGameSessionService.kickUserSession(guid, "delete mail");
String attrib = dynamoDBService.deleteMail(type, guid, mail_guid); dynamodbMailService.deleteMail(type, guid, mail_guid);
if(!attrib.isEmpty()){
JSONObject jsonObject = new JSONObject();
jsonObject.put("data",attrib);
historyService.setLog(HISTORYTYPE.USER_MAIL_DELETE, jsonObject);
}
return UsersResponse.builder() return UsersResponse.builder()
.status(CommonCode.SUCCESS.getHttpStatus()) .status(CommonCode.SUCCESS.getHttpStatus())
@@ -438,13 +395,12 @@ public class UsersService {
.build(); .build();
} }
//우편 아이템 삭제
public UsersResponse deleteMailItem(MailRequest.DeleteMailItem deleteMailItem){ public UsersResponse deleteMailItem(MailRequest.DeleteMailItem deleteMailItem){
userGameSessionService.kickUserSession(deleteMailItem.getGuid(), "delete mail item"); userGameSessionService.kickUserSession(deleteMailItem.getGuid(), "delete mail item");
JSONObject json = dynamoDBService.updateMailItem(deleteMailItem.getType(), deleteMailItem.getGuid(), dynamodbMailService.deleteMailItem(deleteMailItem.getType(), deleteMailItem.getGuid(),
deleteMailItem.getMailGuid(), deleteMailItem.getItemId(), deleteMailItem.getParrentCount(), deleteMailItem.getCount()); deleteMailItem.getMailGuid(), deleteMailItem.getItemId(), deleteMailItem.getParrentCount(), deleteMailItem.getCount());
if(!json.isEmpty()){
historyService.setLog(HISTORYTYPE.MAIL_ITEM_UPDATE, json);
}
return UsersResponse.builder() return UsersResponse.builder()
.status(CommonCode.SUCCESS.getHttpStatus()) .status(CommonCode.SUCCESS.getHttpStatus())
.result(CommonCode.SUCCESS.getResult()) .result(CommonCode.SUCCESS.getResult())
@@ -454,6 +410,7 @@ public class UsersService {
.build(); .build();
} }
//마이홈 정보
public UsersResponse getMyhome(String guid){ public UsersResponse getMyhome(String guid){
UsersResponse.Myhome myhome = dynamoDBService.getMyhome(guid); UsersResponse.Myhome myhome = dynamoDBService.getMyhome(guid);
@@ -470,6 +427,7 @@ public class UsersService {
} }
//친구 목록
public UsersResponse getFriendList(String guid){ public UsersResponse getFriendList(String guid){
List<UsersResponse.Friend> friendList = dynamoDBService.getFriendList(guid); List<UsersResponse.Friend> friendList = dynamoDBService.getFriendList(guid);
@@ -518,6 +476,7 @@ public class UsersService {
.build(); .build();
} }
//타투 정보
public UsersResponse getTattoo(String guid){ public UsersResponse getTattoo(String guid){
List<UsersResponse.Tattoo> resTatto = dynamoDBService.getTattoo(guid); List<UsersResponse.Tattoo> resTatto = dynamoDBService.getTattoo(guid);
@@ -533,29 +492,8 @@ public class UsersService {
} }
//퀘스트 정보
public UsersResponse getQuest(String guid){ public UsersResponse getQuest(String guid){
// UsersResponse.Quest quest = new UsersResponse.Quest();
//
// List<UsersResponse.Quest> questListQuest = new ArrayList<>();
//
// Map<String, List<Map<String, Object>>> resMap= dynamoDBService.getQuest(guid);
//
// //List<Map<String, Object>> endList = resMap.get("EndList");
// List<Map<String, Object>> questList = resMap.get("QuestList");
//
// int index = 1;
// if(questList != null){
// for (Map<String,Object> val : questList){
// if(val != null){
// quest = new UsersResponse.Quest();
// quest.setQuestId(Integer.valueOf(CommonUtils.objectToString(val.get("QuestId"))));
// quest.setStatus(CommonUtils.objectToString(val.get("IsComplete")));
// quest.setRowNum((long)index);
// questListQuest.add(quest);
// index++;
// }
// }
// }
List<UsersResponse.QuestInfo> questList = dynamoDBService.getQuest(guid); List<UsersResponse.QuestInfo> questList = dynamoDBService.getQuest(guid);
@@ -570,20 +508,5 @@ public class UsersService {
.build(); .build();
} }
/*public UsersResponse getClaim(String guid){
List<UsersResponse.Guid> tattoo = dynamoDBService.getTattoo(guid);
return UsersResponse.builder()
.resultData(
UsersResponse.ResultData.builder()
.tattooList(tattoo)
.build()
)
.status(CommonCode.SUCCESS.getHttpStatus())
.result(CommonCode.SUCCESS.getResult())
.build();
}*/
} }

View File

@@ -6,7 +6,7 @@ import com.caliverse.admin.dynamodb.service.DynamoDBOperations;
import com.caliverse.admin.global.common.code.CommonCode; import com.caliverse.admin.global.common.code.CommonCode;
import com.caliverse.admin.global.common.code.ErrorCode; import com.caliverse.admin.global.common.code.ErrorCode;
import com.caliverse.admin.global.common.exception.RestApiException; import com.caliverse.admin.global.common.exception.RestApiException;
import com.caliverse.admin.history.service.DynamodbHistoryLogService; import com.caliverse.admin.mongodb.service.DynamodbHistoryLogService;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;

View File

@@ -1,28 +1,20 @@
package com.caliverse.admin.dynamodb.repository.Impl; package com.caliverse.admin.dynamodb.repository.Impl;
import com.caliverse.admin.domain.RabbitMq.message.AuthAdminLevelType;
import com.caliverse.admin.domain.entity.BlackList; import com.caliverse.admin.domain.entity.BlackList;
import com.caliverse.admin.domain.entity.HISTORYTYPE; import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
import com.caliverse.admin.dynamodb.domain.atrrib.AccountBaseAttrib; import com.caliverse.admin.dynamodb.domain.atrrib.AccountBaseAttrib;
import com.caliverse.admin.dynamodb.domain.atrrib.LandAuctionRegistryAttrib;
import com.caliverse.admin.dynamodb.domain.atrrib.UserNicknameRegistryAttrib;
import com.caliverse.admin.dynamodb.domain.doc.AccountBaseDoc; import com.caliverse.admin.dynamodb.domain.doc.AccountBaseDoc;
import com.caliverse.admin.dynamodb.domain.doc.LandAuctionRegistryDoc;
import com.caliverse.admin.dynamodb.domain.doc.UserNicknameRegistryDoc;
import com.caliverse.admin.dynamodb.entity.EAuthAdminLevelType; import com.caliverse.admin.dynamodb.entity.EAuthAdminLevelType;
import com.caliverse.admin.dynamodb.repository.AccountBaseRepository; import com.caliverse.admin.dynamodb.repository.AccountBaseRepository;
import com.caliverse.admin.dynamodb.repository.BaseDynamoDBRepository; import com.caliverse.admin.dynamodb.repository.BaseDynamoDBRepository;
import com.caliverse.admin.dynamodb.repository.UserNicknameRegistryRepository;
import com.caliverse.admin.dynamodb.service.DynamoDBOperations; import com.caliverse.admin.dynamodb.service.DynamoDBOperations;
import com.caliverse.admin.global.common.code.CommonCode; import com.caliverse.admin.global.common.code.CommonCode;
import com.caliverse.admin.global.common.code.ErrorCode; import com.caliverse.admin.global.common.code.ErrorCode;
import com.caliverse.admin.global.common.constants.CommonConstants;
import com.caliverse.admin.global.common.constants.DynamoDBConstants; import com.caliverse.admin.global.common.constants.DynamoDBConstants;
import com.caliverse.admin.global.common.exception.RestApiException; import com.caliverse.admin.global.common.exception.RestApiException;
import com.caliverse.admin.global.common.utils.CommonUtils; import com.caliverse.admin.global.common.utils.CommonUtils;
import com.caliverse.admin.history.service.DynamodbHistoryLogService; import com.caliverse.admin.mongodb.service.DynamodbHistoryLogService;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@@ -31,8 +23,6 @@ import software.amazon.awssdk.enhanced.dynamodb.Key;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import static com.caliverse.admin.global.common.utils.DateUtils.getDynamodbDateFormat; import static com.caliverse.admin.global.common.utils.DateUtils.getDynamodbDateFormat;
@@ -91,8 +81,8 @@ public class AccountBaseRepositoryImpl extends BaseDynamoDBRepository<AccountBas
log.info("updateBlockUserStart Update Success: {}", objectMapper.writeValueAsString(afterDoc)); log.info("updateBlockUserStart Update Success: {}", objectMapper.writeValueAsString(afterDoc));
dynamodbHistoryLogService.updateHistoryLog( dynamodbHistoryLogService.updateHistoryLog(
HISTORYTYPE.BLACKLIST_UPDATE, HISTORYTYPEDETAIL.BLACKLIST_UPDATE,
HISTORYTYPE.BLACKLIST_UPDATE.name(), HISTORYTYPEDETAIL.BLACKLIST_UPDATE.name(),
beforeDoc, beforeDoc,
afterDoc afterDoc
); );
@@ -131,8 +121,8 @@ public class AccountBaseRepositoryImpl extends BaseDynamoDBRepository<AccountBas
log.info("updateBlockUserEnd Update Success: {}", objectMapper.writeValueAsString(afterDoc)); log.info("updateBlockUserEnd Update Success: {}", objectMapper.writeValueAsString(afterDoc));
dynamodbHistoryLogService.updateHistoryLog( dynamodbHistoryLogService.updateHistoryLog(
HISTORYTYPE.BLACKLIST_UPDATE, HISTORYTYPEDETAIL.BLACKLIST_UPDATE,
HISTORYTYPE.BLACKLIST_UPDATE.name(), HISTORYTYPEDETAIL.BLACKLIST_UPDATE.name(),
beforeDoc, beforeDoc,
afterDoc afterDoc
); );
@@ -166,8 +156,8 @@ public class AccountBaseRepositoryImpl extends BaseDynamoDBRepository<AccountBas
log.info("updateAdminLevel Update Success: {}", objectMapper.writeValueAsString(afterDoc)); log.info("updateAdminLevel Update Success: {}", objectMapper.writeValueAsString(afterDoc));
dynamodbHistoryLogService.updateHistoryLog( dynamodbHistoryLogService.updateHistoryLog(
HISTORYTYPE.USER_ADMIN_AUTH_UPDATE, HISTORYTYPEDETAIL.USER_ADMIN_AUTH_UPDATE,
HISTORYTYPE.USER_ADMIN_AUTH_UPDATE.name(), HISTORYTYPEDETAIL.USER_ADMIN_AUTH_UPDATE.name(),
beforeDoc, beforeDoc,
afterDoc afterDoc
); );

View File

@@ -1,12 +1,10 @@
package com.caliverse.admin.dynamodb.repository.Impl; package com.caliverse.admin.dynamodb.repository.Impl;
import com.caliverse.admin.domain.entity.BattleEvent; import com.caliverse.admin.domain.entity.BattleEvent;
import com.caliverse.admin.domain.entity.HISTORYTYPE; import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
import com.caliverse.admin.domain.request.BattleEventRequest; import com.caliverse.admin.domain.request.BattleEventRequest;
import com.caliverse.admin.dynamodb.domain.atrrib.BattleEventAttrib; import com.caliverse.admin.dynamodb.domain.atrrib.BattleEventAttrib;
import com.caliverse.admin.dynamodb.domain.atrrib.LandAuctionRegistryAttrib;
import com.caliverse.admin.dynamodb.domain.doc.BattleEventDoc; import com.caliverse.admin.dynamodb.domain.doc.BattleEventDoc;
import com.caliverse.admin.dynamodb.domain.doc.LandAuctionRegistryDoc;
import com.caliverse.admin.dynamodb.entity.EDayOfWeekType; import com.caliverse.admin.dynamodb.entity.EDayOfWeekType;
import com.caliverse.admin.dynamodb.entity.EOncePeriodRangeType; import com.caliverse.admin.dynamodb.entity.EOncePeriodRangeType;
import com.caliverse.admin.dynamodb.repository.BaseDynamoDBRepository; import com.caliverse.admin.dynamodb.repository.BaseDynamoDBRepository;
@@ -17,7 +15,7 @@ import com.caliverse.admin.global.common.code.ErrorCode;
import com.caliverse.admin.global.common.constants.DynamoDBConstants; import com.caliverse.admin.global.common.constants.DynamoDBConstants;
import com.caliverse.admin.global.common.exception.RestApiException; import com.caliverse.admin.global.common.exception.RestApiException;
import com.caliverse.admin.global.common.utils.CommonUtils; import com.caliverse.admin.global.common.utils.CommonUtils;
import com.caliverse.admin.history.service.DynamodbHistoryLogService; import com.caliverse.admin.mongodb.service.DynamodbHistoryLogService;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@@ -117,8 +115,8 @@ public class BattleEventRepositoryImpl extends BaseDynamoDBRepository<BattleEven
save(doc); save(doc);
dynamodbHistoryLogService.insertHistoryLog( dynamodbHistoryLogService.insertHistoryLog(
HISTORYTYPE.BATTLE_EVENT_ADD, HISTORYTYPEDETAIL.BATTLE_EVENT_ADD,
HISTORYTYPE.BATTLE_EVENT_ADD.name(), HISTORYTYPEDETAIL.BATTLE_EVENT_ADD.name(),
doc doc
); );
}catch (Exception e){ }catch (Exception e){
@@ -162,8 +160,8 @@ public class BattleEventRepositoryImpl extends BaseDynamoDBRepository<BattleEven
log.info("BattleEventDoc Update Success: {}", objectMapper.writeValueAsString(afterDoc)); log.info("BattleEventDoc Update Success: {}", objectMapper.writeValueAsString(afterDoc));
dynamodbHistoryLogService.updateHistoryLog( dynamodbHistoryLogService.updateHistoryLog(
HISTORYTYPE.BATTLE_EVENT_UPDATE, HISTORYTYPEDETAIL.BATTLE_EVENT_UPDATE,
HISTORYTYPE.BATTLE_EVENT_UPDATE.name(), HISTORYTYPEDETAIL.BATTLE_EVENT_UPDATE.name(),
beforeDoc, beforeDoc,
afterDoc afterDoc
); );
@@ -202,8 +200,8 @@ public class BattleEventRepositoryImpl extends BaseDynamoDBRepository<BattleEven
log.info("BattleEventDoc Update Stop Success: {}", objectMapper.writeValueAsString(afterDoc)); log.info("BattleEventDoc Update Stop Success: {}", objectMapper.writeValueAsString(afterDoc));
dynamodbHistoryLogService.updateHistoryLog( dynamodbHistoryLogService.updateHistoryLog(
HISTORYTYPE.BATTLE_EVENT_UPDATE, HISTORYTYPEDETAIL.BATTLE_EVENT_UPDATE,
HISTORYTYPE.BATTLE_EVENT_UPDATE.name(), HISTORYTYPEDETAIL.BATTLE_EVENT_UPDATE.name(),
beforeDoc, beforeDoc,
afterDoc afterDoc
); );

View File

@@ -1,6 +1,6 @@
package com.caliverse.admin.dynamodb.repository.Impl; package com.caliverse.admin.dynamodb.repository.Impl;
import com.caliverse.admin.domain.entity.HISTORYTYPE; import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
import com.caliverse.admin.domain.request.LandRequest; import com.caliverse.admin.domain.request.LandRequest;
import com.caliverse.admin.dynamodb.domain.atrrib.BuildingAttrib; import com.caliverse.admin.dynamodb.domain.atrrib.BuildingAttrib;
import com.caliverse.admin.dynamodb.domain.doc.BuildingDoc; import com.caliverse.admin.dynamodb.domain.doc.BuildingDoc;
@@ -14,7 +14,7 @@ import com.caliverse.admin.global.common.code.ErrorCode;
import com.caliverse.admin.global.common.constants.DynamoDBConstants; import com.caliverse.admin.global.common.constants.DynamoDBConstants;
import com.caliverse.admin.global.common.exception.RestApiException; import com.caliverse.admin.global.common.exception.RestApiException;
import com.caliverse.admin.global.common.utils.CommonUtils; import com.caliverse.admin.global.common.utils.CommonUtils;
import com.caliverse.admin.history.service.DynamodbHistoryLogService; import com.caliverse.admin.mongodb.service.DynamodbHistoryLogService;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@@ -86,8 +86,8 @@ public class BuildingRepositoryImpl extends BaseDynamoDBRepository<BuildingDoc>
log.info("BuildingDoc Insert Success: {}", objectMapper.writeValueAsString(doc)); log.info("BuildingDoc Insert Success: {}", objectMapper.writeValueAsString(doc));
dynamodbHistoryLogService.insertHistoryLog( dynamodbHistoryLogService.insertHistoryLog(
HISTORYTYPE.LAND_OWNER_CHANGE_ADD, HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_ADD,
HISTORYTYPE.LAND_OWNER_CHANGE_ADD.name(), HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_ADD.name(),
doc doc
); );
@@ -127,8 +127,8 @@ public class BuildingRepositoryImpl extends BaseDynamoDBRepository<BuildingDoc>
log.info("BuildingDoc Update Success: {}", objectMapper.writeValueAsString(afterDoc)); log.info("BuildingDoc Update Success: {}", objectMapper.writeValueAsString(afterDoc));
dynamodbHistoryLogService.updateHistoryLog( dynamodbHistoryLogService.updateHistoryLog(
HISTORYTYPE.LAND_OWNER_CHANGE_UPDATE, HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_UPDATE,
HISTORYTYPE.LAND_OWNER_CHANGE_UPDATE.name(), HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_UPDATE.name(),
beforeDoc, beforeDoc,
afterDoc afterDoc
); );
@@ -163,8 +163,8 @@ public class BuildingRepositoryImpl extends BaseDynamoDBRepository<BuildingDoc>
log.info("BuildingDoc Owned Init Update Success: {}", objectMapper.writeValueAsString(afterDoc)); log.info("BuildingDoc Owned Init Update Success: {}", objectMapper.writeValueAsString(afterDoc));
dynamodbHistoryLogService.updateHistoryLog( dynamodbHistoryLogService.updateHistoryLog(
HISTORYTYPE.LAND_OWNED_INITIALIZE, HISTORYTYPEDETAIL.LAND_OWNED_INITIALIZE,
HISTORYTYPE.LAND_OWNED_INITIALIZE.name(), HISTORYTYPEDETAIL.LAND_OWNED_INITIALIZE.name(),
beforeDoc, beforeDoc,
afterDoc afterDoc
); );
@@ -206,8 +206,8 @@ public class BuildingRepositoryImpl extends BaseDynamoDBRepository<BuildingDoc>
log.info("BuildingDoc Desc Init Update Success: {}", objectMapper.writeValueAsString(afterDoc)); log.info("BuildingDoc Desc Init Update Success: {}", objectMapper.writeValueAsString(afterDoc));
dynamodbHistoryLogService.updateHistoryLog( dynamodbHistoryLogService.updateHistoryLog(
HISTORYTYPE.LAND_DESC_INITIALIZE, HISTORYTYPEDETAIL.LAND_DESC_INITIALIZE,
HISTORYTYPE.LAND_DESC_INITIALIZE.name(), HISTORYTYPEDETAIL.LAND_DESC_INITIALIZE.name(),
beforeDoc, beforeDoc,
afterDoc afterDoc
); );

View File

@@ -1,6 +1,6 @@
package com.caliverse.admin.dynamodb.repository.Impl; package com.caliverse.admin.dynamodb.repository.Impl;
import com.caliverse.admin.domain.entity.HISTORYTYPE; import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
import com.caliverse.admin.dynamodb.domain.atrrib.CaliumStorageAttrib; import com.caliverse.admin.dynamodb.domain.atrrib.CaliumStorageAttrib;
import com.caliverse.admin.dynamodb.domain.doc.CaliumStorageDoc; import com.caliverse.admin.dynamodb.domain.doc.CaliumStorageDoc;
import com.caliverse.admin.dynamodb.repository.BaseDynamoDBRepository; import com.caliverse.admin.dynamodb.repository.BaseDynamoDBRepository;
@@ -11,7 +11,7 @@ import com.caliverse.admin.global.common.code.ErrorCode;
import com.caliverse.admin.global.common.constants.DynamoDBConstants; import com.caliverse.admin.global.common.constants.DynamoDBConstants;
import com.caliverse.admin.global.common.exception.RestApiException; import com.caliverse.admin.global.common.exception.RestApiException;
import com.caliverse.admin.global.common.utils.CommonUtils; import com.caliverse.admin.global.common.utils.CommonUtils;
import com.caliverse.admin.history.service.DynamodbHistoryLogService; import com.caliverse.admin.mongodb.service.DynamodbHistoryLogService;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@@ -83,8 +83,8 @@ public class CaliumStorageRepositoryImpl extends BaseDynamoDBRepository<CaliumSt
log.info("CaliumStorageDoc Calium Total Update Success: {}", objectMapper.writeValueAsString(afterDoc)); log.info("CaliumStorageDoc Calium Total Update Success: {}", objectMapper.writeValueAsString(afterDoc));
dynamodbHistoryLogService.updateHistoryLog( dynamodbHistoryLogService.updateHistoryLog(
HISTORYTYPE.CALIUM_TOTAL_UPDATE, HISTORYTYPEDETAIL.CALIUM_TOTAL_UPDATE,
HISTORYTYPE.CALIUM_TOTAL_UPDATE.name(), HISTORYTYPEDETAIL.CALIUM_TOTAL_UPDATE.name(),
beforeDoc, beforeDoc,
afterDoc afterDoc
); );
@@ -131,8 +131,8 @@ public class CaliumStorageRepositoryImpl extends BaseDynamoDBRepository<CaliumSt
log.info("CaliumStorageDoc Calium Total Update Success: {}", objectMapper.writeValueAsString(afterDoc)); log.info("CaliumStorageDoc Calium Total Update Success: {}", objectMapper.writeValueAsString(afterDoc));
dynamodbHistoryLogService.updateHistoryLog( dynamodbHistoryLogService.updateHistoryLog(
HISTORYTYPE.CALIUM_TOTAL_UPDATE, HISTORYTYPEDETAIL.CALIUM_TOTAL_UPDATE,
HISTORYTYPE.CALIUM_TOTAL_UPDATE.name(), HISTORYTYPEDETAIL.CALIUM_TOTAL_UPDATE.name(),
beforeDoc, beforeDoc,
afterDoc afterDoc
); );

View File

@@ -1,12 +1,9 @@
package com.caliverse.admin.dynamodb.repository.Impl; package com.caliverse.admin.dynamodb.repository.Impl;
import com.caliverse.admin.domain.entity.EFilterOperator; import com.caliverse.admin.domain.entity.EFilterOperator;
import com.caliverse.admin.domain.entity.HISTORYTYPE; import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
import com.caliverse.admin.domain.entity.SEARCHTYPE;
import com.caliverse.admin.dynamodb.domain.atrrib.ItemAttrib; import com.caliverse.admin.dynamodb.domain.atrrib.ItemAttrib;
import com.caliverse.admin.dynamodb.domain.atrrib.LandAuctionRegistryAttrib;
import com.caliverse.admin.dynamodb.domain.doc.ItemDoc; import com.caliverse.admin.dynamodb.domain.doc.ItemDoc;
import com.caliverse.admin.dynamodb.domain.doc.LandAuctionRegistryDoc;
import com.caliverse.admin.dynamodb.dto.PageResult; import com.caliverse.admin.dynamodb.dto.PageResult;
import com.caliverse.admin.dynamodb.repository.BaseDynamoDBRepository; import com.caliverse.admin.dynamodb.repository.BaseDynamoDBRepository;
import com.caliverse.admin.dynamodb.repository.ItemRepository; import com.caliverse.admin.dynamodb.repository.ItemRepository;
@@ -16,7 +13,7 @@ import com.caliverse.admin.global.common.code.ErrorCode;
import com.caliverse.admin.global.common.constants.DynamoDBConstants; import com.caliverse.admin.global.common.constants.DynamoDBConstants;
import com.caliverse.admin.global.common.exception.RestApiException; import com.caliverse.admin.global.common.exception.RestApiException;
import com.caliverse.admin.global.common.utils.CommonUtils; import com.caliverse.admin.global.common.utils.CommonUtils;
import com.caliverse.admin.history.service.DynamodbHistoryLogService; import com.caliverse.admin.mongodb.service.DynamodbHistoryLogService;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@@ -82,8 +79,8 @@ public class ItemRepositoryImpl extends BaseDynamoDBRepository<ItemDoc> implemen
log.info("updateItemStack Update Success: {}", CommonUtils.objectByString(afterDoc)); log.info("updateItemStack Update Success: {}", CommonUtils.objectByString(afterDoc));
dynamodbHistoryLogService.updateHistoryLog( dynamodbHistoryLogService.updateHistoryLog(
HISTORYTYPE.ITEM_UPDATE, HISTORYTYPEDETAIL.ITEM_UPDATE,
HISTORYTYPE.ITEM_UPDATE.name(), HISTORYTYPEDETAIL.ITEM_UPDATE.name(),
beforeDoc, beforeDoc,
afterDoc afterDoc
); );
@@ -110,8 +107,8 @@ public class ItemRepositoryImpl extends BaseDynamoDBRepository<ItemDoc> implemen
log.info("ItemDoc Delete Success: {}", CommonUtils.objectByString(beforeDoc)); log.info("ItemDoc Delete Success: {}", CommonUtils.objectByString(beforeDoc));
dynamodbHistoryLogService.deleteHistoryLog( dynamodbHistoryLogService.deleteHistoryLog(
HISTORYTYPE.ITEM_DELETE, HISTORYTYPEDETAIL.ITEM_DELETE,
HISTORYTYPE.ITEM_DELETE.name(), HISTORYTYPEDETAIL.ITEM_DELETE.name(),
beforeDoc beforeDoc
); );
} }

View File

@@ -1,10 +1,9 @@
package com.caliverse.admin.dynamodb.repository.Impl; package com.caliverse.admin.dynamodb.repository.Impl;
import com.caliverse.admin.domain.entity.HISTORYTYPE; import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
import com.caliverse.admin.domain.request.LandRequest; import com.caliverse.admin.domain.request.LandRequest;
import com.caliverse.admin.dynamodb.domain.atrrib.LandAuctionActivityAttrib; import com.caliverse.admin.dynamodb.domain.atrrib.LandAuctionActivityAttrib;
import com.caliverse.admin.dynamodb.domain.doc.LandAuctionActivityDoc; import com.caliverse.admin.dynamodb.domain.doc.LandAuctionActivityDoc;
import com.caliverse.admin.dynamodb.domain.doc.LandAuctionRegistryDoc;
import com.caliverse.admin.dynamodb.entity.DynamodbOperationResult; import com.caliverse.admin.dynamodb.entity.DynamodbOperationResult;
import com.caliverse.admin.dynamodb.repository.BaseDynamoDBRepository; import com.caliverse.admin.dynamodb.repository.BaseDynamoDBRepository;
import com.caliverse.admin.dynamodb.repository.LandAuctionActivityRepository; import com.caliverse.admin.dynamodb.repository.LandAuctionActivityRepository;
@@ -14,14 +13,13 @@ import com.caliverse.admin.global.common.code.ErrorCode;
import com.caliverse.admin.global.common.constants.DynamoDBConstants; import com.caliverse.admin.global.common.constants.DynamoDBConstants;
import com.caliverse.admin.global.common.exception.RestApiException; import com.caliverse.admin.global.common.exception.RestApiException;
import com.caliverse.admin.global.common.utils.CommonUtils; import com.caliverse.admin.global.common.utils.CommonUtils;
import com.caliverse.admin.history.service.DynamodbHistoryLogService; import com.caliverse.admin.mongodb.service.DynamodbHistoryLogService;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import software.amazon.awssdk.enhanced.dynamodb.Key; import software.amazon.awssdk.enhanced.dynamodb.Key;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List;
@Component @Component
@Slf4j @Slf4j
@@ -75,8 +73,8 @@ public class LandAuctionActivityRepositoryImpl extends BaseDynamoDBRepository<La
log.info("LandAuctionActivityDoc Delete Success: {}", objectMapper.writeValueAsString(doc)); log.info("LandAuctionActivityDoc Delete Success: {}", objectMapper.writeValueAsString(doc));
dynamodbHistoryLogService.deleteHistoryLog( dynamodbHistoryLogService.deleteHistoryLog(
HISTORYTYPE.LAND_AUCTION_INITIALIZE, HISTORYTYPEDETAIL.LAND_AUCTION_INITIALIZE,
HISTORYTYPE.LAND_AUCTION_INITIALIZE.name(), HISTORYTYPEDETAIL.LAND_AUCTION_INITIALIZE.name(),
doc doc
); );
@@ -110,8 +108,8 @@ public class LandAuctionActivityRepositoryImpl extends BaseDynamoDBRepository<La
log.info("LandAuctionActivityDoc Insert Success: {}", objectMapper.writeValueAsString(activityDoc)); log.info("LandAuctionActivityDoc Insert Success: {}", objectMapper.writeValueAsString(activityDoc));
dynamodbHistoryLogService.insertHistoryLog( dynamodbHistoryLogService.insertHistoryLog(
HISTORYTYPE.LAND_AUCTION_ADD, HISTORYTYPEDETAIL.LAND_AUCTION_ADD,
HISTORYTYPE.LAND_AUCTION_ADD.name(), HISTORYTYPEDETAIL.LAND_AUCTION_ADD.name(),
activityDoc activityDoc
); );
}catch (Exception e){ }catch (Exception e){
@@ -134,8 +132,8 @@ public class LandAuctionActivityRepositoryImpl extends BaseDynamoDBRepository<La
log.info("LandAuctionActivityDoc Update Success: {}", objectMapper.writeValueAsString(afterDoc)); log.info("LandAuctionActivityDoc Update Success: {}", objectMapper.writeValueAsString(afterDoc));
dynamodbHistoryLogService.updateHistoryLog( dynamodbHistoryLogService.updateHistoryLog(
HISTORYTYPE.LAND_AUCTION_ADD, HISTORYTYPEDETAIL.LAND_AUCTION_ADD,
HISTORYTYPE.LAND_AUCTION_ADD.name(), HISTORYTYPEDETAIL.LAND_AUCTION_ADD.name(),
existingDoc, existingDoc,
afterDoc afterDoc
); );

View File

@@ -1,30 +1,25 @@
package com.caliverse.admin.dynamodb.repository.Impl; package com.caliverse.admin.dynamodb.repository.Impl;
import com.caliverse.admin.domain.entity.HISTORYTYPE; import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
import com.caliverse.admin.domain.request.LandRequest; import com.caliverse.admin.domain.request.LandRequest;
import com.caliverse.admin.dynamodb.domain.atrrib.LandAuctionHighestBidUserAttrib; import com.caliverse.admin.dynamodb.domain.atrrib.LandAuctionHighestBidUserAttrib;
import com.caliverse.admin.dynamodb.domain.atrrib.LandAuctionRegistryAttrib;
import com.caliverse.admin.dynamodb.domain.doc.LandAuctionActivityDoc;
import com.caliverse.admin.dynamodb.domain.doc.LandAuctionHighestBidUserDoc; import com.caliverse.admin.dynamodb.domain.doc.LandAuctionHighestBidUserDoc;
import com.caliverse.admin.dynamodb.domain.doc.LandAuctionRegistryDoc;
import com.caliverse.admin.dynamodb.entity.DynamodbOperationResult; import com.caliverse.admin.dynamodb.entity.DynamodbOperationResult;
import com.caliverse.admin.dynamodb.repository.BaseDynamoDBRepository; import com.caliverse.admin.dynamodb.repository.BaseDynamoDBRepository;
import com.caliverse.admin.dynamodb.repository.LandAuctionHighestBidUserRepository; import com.caliverse.admin.dynamodb.repository.LandAuctionHighestBidUserRepository;
import com.caliverse.admin.dynamodb.service.DynamoDBOperations; import com.caliverse.admin.dynamodb.service.DynamoDBOperations;
import com.caliverse.admin.global.common.code.CommonCode; import com.caliverse.admin.global.common.code.CommonCode;
import com.caliverse.admin.global.common.code.ErrorCode; import com.caliverse.admin.global.common.code.ErrorCode;
import com.caliverse.admin.global.common.constants.CommonConstants;
import com.caliverse.admin.global.common.constants.DynamoDBConstants; import com.caliverse.admin.global.common.constants.DynamoDBConstants;
import com.caliverse.admin.global.common.exception.RestApiException; import com.caliverse.admin.global.common.exception.RestApiException;
import com.caliverse.admin.global.common.utils.CommonUtils; import com.caliverse.admin.global.common.utils.CommonUtils;
import com.caliverse.admin.history.service.DynamodbHistoryLogService; import com.caliverse.admin.mongodb.service.DynamodbHistoryLogService;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import software.amazon.awssdk.enhanced.dynamodb.Key; import software.amazon.awssdk.enhanced.dynamodb.Key;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List;
@Component @Component
@Slf4j @Slf4j
@@ -76,8 +71,8 @@ public class LandAuctionHighestBidUserRepositoryImpl extends BaseDynamoDBReposit
log.info("LandAuctionRegistryDoc Insert Success: {}", objectMapper.writeValueAsString(registry)); log.info("LandAuctionRegistryDoc Insert Success: {}", objectMapper.writeValueAsString(registry));
dynamodbHistoryLogService.insertHistoryLog( dynamodbHistoryLogService.insertHistoryLog(
HISTORYTYPE.LAND_AUCTION_ADD, HISTORYTYPEDETAIL.LAND_AUCTION_ADD,
HISTORYTYPE.LAND_AUCTION_ADD.name(), HISTORYTYPEDETAIL.LAND_AUCTION_ADD.name(),
registry registry
); );
@@ -104,8 +99,8 @@ public class LandAuctionHighestBidUserRepositoryImpl extends BaseDynamoDBReposit
log.info("LandAuctionHighestBidUserDoc Delete Success: {}", objectMapper.writeValueAsString(doc)); log.info("LandAuctionHighestBidUserDoc Delete Success: {}", objectMapper.writeValueAsString(doc));
dynamodbHistoryLogService.deleteHistoryLog( dynamodbHistoryLogService.deleteHistoryLog(
HISTORYTYPE.LAND_AUCTION_INITIALIZE, HISTORYTYPEDETAIL.LAND_AUCTION_INITIALIZE,
HISTORYTYPE.LAND_AUCTION_INITIALIZE.name(), HISTORYTYPEDETAIL.LAND_AUCTION_INITIALIZE.name(),
doc doc
); );
return new DynamodbOperationResult(true, "delete success", doc); return new DynamodbOperationResult(true, "delete success", doc);

View File

@@ -1,26 +1,18 @@
package com.caliverse.admin.dynamodb.repository.Impl; package com.caliverse.admin.dynamodb.repository.Impl;
import com.caliverse.admin.domain.entity.HISTORYTYPE; import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
import com.caliverse.admin.dynamodb.domain.doc.LandAuctionActivityDoc;
import com.caliverse.admin.dynamodb.domain.doc.LandAuctionRecordDoc; import com.caliverse.admin.dynamodb.domain.doc.LandAuctionRecordDoc;
import com.caliverse.admin.dynamodb.domain.doc.LandAuctionRegistryDoc;
import com.caliverse.admin.dynamodb.entity.DynamodbOperationResult; import com.caliverse.admin.dynamodb.entity.DynamodbOperationResult;
import com.caliverse.admin.dynamodb.repository.BaseDynamoDBRepository; import com.caliverse.admin.dynamodb.repository.BaseDynamoDBRepository;
import com.caliverse.admin.dynamodb.repository.LandAuctionRecordRepository; import com.caliverse.admin.dynamodb.repository.LandAuctionRecordRepository;
import com.caliverse.admin.dynamodb.service.DynamoDBOperations; import com.caliverse.admin.dynamodb.service.DynamoDBOperations;
import com.caliverse.admin.global.common.code.CommonCode;
import com.caliverse.admin.global.common.code.ErrorCode;
import com.caliverse.admin.global.common.constants.DynamoDBConstants; import com.caliverse.admin.global.common.constants.DynamoDBConstants;
import com.caliverse.admin.global.common.exception.RestApiException; import com.caliverse.admin.mongodb.service.DynamodbHistoryLogService;
import com.caliverse.admin.global.common.utils.CommonUtils;
import com.caliverse.admin.history.service.DynamodbHistoryLogService;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import software.amazon.awssdk.enhanced.dynamodb.Key; import software.amazon.awssdk.enhanced.dynamodb.Key;
import java.util.List;
@Component @Component
@Slf4j @Slf4j
public class LandAuctionRecordRepositoryImpl extends BaseDynamoDBRepository<LandAuctionRecordDoc> implements LandAuctionRecordRepository { public class LandAuctionRecordRepositoryImpl extends BaseDynamoDBRepository<LandAuctionRecordDoc> implements LandAuctionRecordRepository {
@@ -45,8 +37,8 @@ public class LandAuctionRecordRepositoryImpl extends BaseDynamoDBRepository<Land
log.info("LandAuctionRecordDoc Delete Success: {}", objectMapper.writeValueAsString(doc)); log.info("LandAuctionRecordDoc Delete Success: {}", objectMapper.writeValueAsString(doc));
dynamodbHistoryLogService.deleteHistoryLog( dynamodbHistoryLogService.deleteHistoryLog(
HISTORYTYPE.LAND_AUCTION_INITIALIZE, HISTORYTYPEDETAIL.LAND_AUCTION_INITIALIZE,
HISTORYTYPE.LAND_AUCTION_INITIALIZE.name(), HISTORYTYPEDETAIL.LAND_AUCTION_INITIALIZE.name(),
doc doc
); );
return new DynamodbOperationResult(true, "delete success", doc); return new DynamodbOperationResult(true, "delete success", doc);

View File

@@ -1,24 +1,18 @@
package com.caliverse.admin.dynamodb.repository.Impl; package com.caliverse.admin.dynamodb.repository.Impl;
import com.caliverse.admin.domain.entity.HISTORYTYPE; import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
import com.caliverse.admin.dynamodb.domain.doc.LandAuctionRefundBidPriceDoc; import com.caliverse.admin.dynamodb.domain.doc.LandAuctionRefundBidPriceDoc;
import com.caliverse.admin.dynamodb.entity.DynamodbOperationResult; import com.caliverse.admin.dynamodb.entity.DynamodbOperationResult;
import com.caliverse.admin.dynamodb.repository.BaseDynamoDBRepository; import com.caliverse.admin.dynamodb.repository.BaseDynamoDBRepository;
import com.caliverse.admin.dynamodb.repository.LandAuctionRefundBidPriceRepository; import com.caliverse.admin.dynamodb.repository.LandAuctionRefundBidPriceRepository;
import com.caliverse.admin.dynamodb.service.DynamoDBOperations; import com.caliverse.admin.dynamodb.service.DynamoDBOperations;
import com.caliverse.admin.global.common.code.CommonCode;
import com.caliverse.admin.global.common.code.ErrorCode;
import com.caliverse.admin.global.common.constants.DynamoDBConstants; import com.caliverse.admin.global.common.constants.DynamoDBConstants;
import com.caliverse.admin.global.common.exception.RestApiException; import com.caliverse.admin.mongodb.service.DynamodbHistoryLogService;
import com.caliverse.admin.global.common.utils.CommonUtils;
import com.caliverse.admin.history.service.DynamodbHistoryLogService;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import software.amazon.awssdk.enhanced.dynamodb.Key; import software.amazon.awssdk.enhanced.dynamodb.Key;
import java.util.List;
@Component @Component
@Slf4j @Slf4j
public class LandAuctionRefundBidPriceRepositoryImpl extends BaseDynamoDBRepository<LandAuctionRefundBidPriceDoc> implements LandAuctionRefundBidPriceRepository { public class LandAuctionRefundBidPriceRepositoryImpl extends BaseDynamoDBRepository<LandAuctionRefundBidPriceDoc> implements LandAuctionRefundBidPriceRepository {
@@ -45,8 +39,8 @@ public class LandAuctionRefundBidPriceRepositoryImpl extends BaseDynamoDBReposit
log.info("LandAuctionRefundBidPriceDoc Delete Success: {}", objectMapper.writeValueAsString(doc)); log.info("LandAuctionRefundBidPriceDoc Delete Success: {}", objectMapper.writeValueAsString(doc));
dynamodbHistoryLogService.deleteHistoryLog( dynamodbHistoryLogService.deleteHistoryLog(
HISTORYTYPE.LAND_AUCTION_INITIALIZE, HISTORYTYPEDETAIL.LAND_AUCTION_INITIALIZE,
HISTORYTYPE.LAND_AUCTION_INITIALIZE.name(), HISTORYTYPEDETAIL.LAND_AUCTION_INITIALIZE.name(),
doc doc
); );
return new DynamodbOperationResult(true, "delete success", doc); return new DynamodbOperationResult(true, "delete success", doc);

View File

@@ -1,14 +1,10 @@
package com.caliverse.admin.dynamodb.repository.Impl; package com.caliverse.admin.dynamodb.repository.Impl;
import com.caliverse.admin.domain.entity.HISTORYTYPE; import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
import com.caliverse.admin.domain.request.LandRequest; import com.caliverse.admin.domain.request.LandRequest;
import com.caliverse.admin.dynamodb.domain.atrrib.BuildingAttrib;
import com.caliverse.admin.dynamodb.domain.atrrib.LandAuctionRegistryAttrib; import com.caliverse.admin.dynamodb.domain.atrrib.LandAuctionRegistryAttrib;
import com.caliverse.admin.dynamodb.domain.doc.BuildingDoc;
import com.caliverse.admin.dynamodb.domain.doc.LandAuctionRegistryDoc; import com.caliverse.admin.dynamodb.domain.doc.LandAuctionRegistryDoc;
import com.caliverse.admin.dynamodb.domain.doc.OwnedBuildingDoc;
import com.caliverse.admin.dynamodb.entity.DynamodbOperationResult; import com.caliverse.admin.dynamodb.entity.DynamodbOperationResult;
import com.caliverse.admin.dynamodb.entity.ECurrencyType;
import com.caliverse.admin.dynamodb.entity.ELandAuctionResult; import com.caliverse.admin.dynamodb.entity.ELandAuctionResult;
import com.caliverse.admin.dynamodb.repository.BaseDynamoDBRepository; import com.caliverse.admin.dynamodb.repository.BaseDynamoDBRepository;
import com.caliverse.admin.dynamodb.repository.LandAuctionRegistryRepository; import com.caliverse.admin.dynamodb.repository.LandAuctionRegistryRepository;
@@ -19,7 +15,7 @@ import com.caliverse.admin.global.common.constants.CommonConstants;
import com.caliverse.admin.global.common.constants.DynamoDBConstants; import com.caliverse.admin.global.common.constants.DynamoDBConstants;
import com.caliverse.admin.global.common.exception.RestApiException; import com.caliverse.admin.global.common.exception.RestApiException;
import com.caliverse.admin.global.common.utils.CommonUtils; import com.caliverse.admin.global.common.utils.CommonUtils;
import com.caliverse.admin.history.service.DynamodbHistoryLogService; import com.caliverse.admin.mongodb.service.DynamodbHistoryLogService;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@@ -102,8 +98,8 @@ public class LandAuctionRegistryRepositoryImpl extends BaseDynamoDBRepository<La
log.info("LandAuctionRegistryDoc Insert Success: {}", objectMapper.writeValueAsString(registry)); log.info("LandAuctionRegistryDoc Insert Success: {}", objectMapper.writeValueAsString(registry));
dynamodbHistoryLogService.insertHistoryLog( dynamodbHistoryLogService.insertHistoryLog(
HISTORYTYPE.LAND_AUCTION_ADD, HISTORYTYPEDETAIL.LAND_AUCTION_ADD,
HISTORYTYPE.LAND_AUCTION_ADD.name(), HISTORYTYPEDETAIL.LAND_AUCTION_ADD.name(),
registry registry
); );
@@ -141,8 +137,8 @@ public class LandAuctionRegistryRepositoryImpl extends BaseDynamoDBRepository<La
log.info("LandAuctionRegistryDoc Update Success: {}", objectMapper.writeValueAsString(afterDoc)); log.info("LandAuctionRegistryDoc Update Success: {}", objectMapper.writeValueAsString(afterDoc));
dynamodbHistoryLogService.updateHistoryLog( dynamodbHistoryLogService.updateHistoryLog(
HISTORYTYPE.LAND_AUCTION_UPDATE, HISTORYTYPEDETAIL.LAND_AUCTION_UPDATE,
HISTORYTYPE.LAND_AUCTION_UPDATE.name(), HISTORYTYPEDETAIL.LAND_AUCTION_UPDATE.name(),
beforeDoc, beforeDoc,
afterDoc afterDoc
); );
@@ -179,8 +175,8 @@ public class LandAuctionRegistryRepositoryImpl extends BaseDynamoDBRepository<La
log.info("LandAuctionRegistryDoc Update Success: {}", objectMapper.writeValueAsString(afterDoc)); log.info("LandAuctionRegistryDoc Update Success: {}", objectMapper.writeValueAsString(afterDoc));
dynamodbHistoryLogService.updateHistoryLog( dynamodbHistoryLogService.updateHistoryLog(
HISTORYTYPE.LAND_AUCTION_UPDATE, HISTORYTYPEDETAIL.LAND_AUCTION_UPDATE,
HISTORYTYPE.LAND_AUCTION_UPDATE.name(), HISTORYTYPEDETAIL.LAND_AUCTION_UPDATE.name(),
beforeDoc, beforeDoc,
afterDoc afterDoc
); );
@@ -211,8 +207,8 @@ public class LandAuctionRegistryRepositoryImpl extends BaseDynamoDBRepository<La
log.info("LandAuctionRegistryDoc Delete Success: {}", objectMapper.writeValueAsString(doc)); log.info("LandAuctionRegistryDoc Delete Success: {}", objectMapper.writeValueAsString(doc));
dynamodbHistoryLogService.deleteHistoryLog( dynamodbHistoryLogService.deleteHistoryLog(
HISTORYTYPE.LAND_AUCTION_INITIALIZE, HISTORYTYPEDETAIL.LAND_AUCTION_INITIALIZE,
HISTORYTYPE.LAND_AUCTION_INITIALIZE.name(), HISTORYTYPEDETAIL.LAND_AUCTION_INITIALIZE.name(),
doc doc
); );

View File

@@ -1,6 +1,6 @@
package com.caliverse.admin.dynamodb.repository.Impl; package com.caliverse.admin.dynamodb.repository.Impl;
import com.caliverse.admin.domain.entity.HISTORYTYPE; import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
import com.caliverse.admin.domain.request.LandRequest; import com.caliverse.admin.domain.request.LandRequest;
import com.caliverse.admin.dynamodb.domain.atrrib.LandAttrib; import com.caliverse.admin.dynamodb.domain.atrrib.LandAttrib;
import com.caliverse.admin.dynamodb.domain.doc.LandDoc; import com.caliverse.admin.dynamodb.domain.doc.LandDoc;
@@ -13,7 +13,7 @@ import com.caliverse.admin.global.common.code.ErrorCode;
import com.caliverse.admin.global.common.constants.DynamoDBConstants; import com.caliverse.admin.global.common.constants.DynamoDBConstants;
import com.caliverse.admin.global.common.exception.RestApiException; import com.caliverse.admin.global.common.exception.RestApiException;
import com.caliverse.admin.global.common.utils.CommonUtils; import com.caliverse.admin.global.common.utils.CommonUtils;
import com.caliverse.admin.history.service.DynamodbHistoryLogService; import com.caliverse.admin.mongodb.service.DynamodbHistoryLogService;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@@ -81,8 +81,8 @@ public class LandRepositoryImpl extends BaseDynamoDBRepository<LandDoc> implemen
log.info("LandDoc Insert Success: {}", objectMapper.writeValueAsString(doc)); log.info("LandDoc Insert Success: {}", objectMapper.writeValueAsString(doc));
dynamodbHistoryLogService.insertHistoryLog( dynamodbHistoryLogService.insertHistoryLog(
HISTORYTYPE.LAND_OWNER_CHANGE_ADD, HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_ADD,
HISTORYTYPE.LAND_OWNER_CHANGE_ADD.name(), HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_ADD.name(),
doc doc
); );
@@ -122,8 +122,8 @@ public class LandRepositoryImpl extends BaseDynamoDBRepository<LandDoc> implemen
log.info("LandDoc Update Success: {}", objectMapper.writeValueAsString(afterDoc)); log.info("LandDoc Update Success: {}", objectMapper.writeValueAsString(afterDoc));
dynamodbHistoryLogService.updateHistoryLog( dynamodbHistoryLogService.updateHistoryLog(
HISTORYTYPE.LAND_OWNER_CHANGE_UPDATE, HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_UPDATE,
HISTORYTYPE.LAND_OWNER_CHANGE_UPDATE.name(), HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_UPDATE.name(),
beforeDoc, beforeDoc,
afterDoc afterDoc
); );
@@ -160,8 +160,8 @@ public class LandRepositoryImpl extends BaseDynamoDBRepository<LandDoc> implemen
log.info("LandDoc Owned Init Update Success: {}", objectMapper.writeValueAsString(afterDoc)); log.info("LandDoc Owned Init Update Success: {}", objectMapper.writeValueAsString(afterDoc));
dynamodbHistoryLogService.updateHistoryLog( dynamodbHistoryLogService.updateHistoryLog(
HISTORYTYPE.LAND_OWNED_INITIALIZE, HISTORYTYPEDETAIL.LAND_OWNED_INITIALIZE,
HISTORYTYPE.LAND_OWNED_INITIALIZE.name(), HISTORYTYPEDETAIL.LAND_OWNED_INITIALIZE.name(),
beforeDoc, beforeDoc,
afterDoc afterDoc
); );
@@ -201,8 +201,8 @@ public class LandRepositoryImpl extends BaseDynamoDBRepository<LandDoc> implemen
log.info("LandDoc Desc Init Update Success: {}", objectMapper.writeValueAsString(afterDoc)); log.info("LandDoc Desc Init Update Success: {}", objectMapper.writeValueAsString(afterDoc));
dynamodbHistoryLogService.updateHistoryLog( dynamodbHistoryLogService.updateHistoryLog(
HISTORYTYPE.LAND_DESC_INITIALIZE, HISTORYTYPEDETAIL.LAND_DESC_INITIALIZE,
HISTORYTYPE.LAND_DESC_INITIALIZE.name(), HISTORYTYPEDETAIL.LAND_DESC_INITIALIZE.name(),
beforeDoc, beforeDoc,
afterDoc afterDoc
); );

View File

@@ -1,17 +1,15 @@
package com.caliverse.admin.dynamodb.repository.Impl; package com.caliverse.admin.dynamodb.repository.Impl;
import com.caliverse.admin.domain.entity.HISTORYTYPE; import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
import com.caliverse.admin.domain.entity.Mail; import com.caliverse.admin.domain.entity.Mail;
import com.caliverse.admin.domain.entity.SEARCHTYPE; import com.caliverse.admin.domain.entity.SEARCHTYPE;
import com.caliverse.admin.domain.entity.metadata.MetaSystemMailData; import com.caliverse.admin.domain.entity.metadata.MetaSystemMailData;
import com.caliverse.admin.dynamodb.domain.atrrib.MailJsonAttrib; import com.caliverse.admin.dynamodb.domain.atrrib.MailJsonAttrib;
import com.caliverse.admin.dynamodb.domain.doc.MailDoc;
import com.caliverse.admin.dynamodb.domain.doc.MailJsonDoc; import com.caliverse.admin.dynamodb.domain.doc.MailJsonDoc;
import com.caliverse.admin.dynamodb.dto.PageResult; import com.caliverse.admin.dynamodb.dto.PageResult;
import com.caliverse.admin.dynamodb.entity.MailItem; import com.caliverse.admin.dynamodb.entity.MailItem;
import com.caliverse.admin.dynamodb.repository.BaseDynamoDBRepository; import com.caliverse.admin.dynamodb.repository.BaseDynamoDBRepository;
import com.caliverse.admin.dynamodb.repository.MailJsonRepository; import com.caliverse.admin.dynamodb.repository.MailJsonRepository;
import com.caliverse.admin.dynamodb.repository.MailRepository;
import com.caliverse.admin.dynamodb.service.DynamoDBOperations; import com.caliverse.admin.dynamodb.service.DynamoDBOperations;
import com.caliverse.admin.global.common.code.CommonCode; import com.caliverse.admin.global.common.code.CommonCode;
import com.caliverse.admin.global.common.code.ErrorCode; import com.caliverse.admin.global.common.code.ErrorCode;
@@ -19,10 +17,11 @@ import com.caliverse.admin.global.common.constants.DynamoDBConstants;
import com.caliverse.admin.global.common.exception.RestApiException; import com.caliverse.admin.global.common.exception.RestApiException;
import com.caliverse.admin.global.common.utils.CommonUtils; import com.caliverse.admin.global.common.utils.CommonUtils;
import com.caliverse.admin.global.common.utils.DateUtils; import com.caliverse.admin.global.common.utils.DateUtils;
import com.caliverse.admin.history.service.DynamodbHistoryLogService; import com.caliverse.admin.mongodb.service.DynamodbHistoryLogService;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import software.amazon.awssdk.enhanced.dynamodb.Key;
import software.amazon.awssdk.services.dynamodb.model.AttributeValue; import software.amazon.awssdk.services.dynamodb.model.AttributeValue;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@@ -83,8 +82,8 @@ public class MailJsonRepositoryImpl extends BaseDynamoDBRepository<MailJsonDoc>
log.info("MailDoc Recv Insert Success: {}", objectMapper.writeValueAsString(doc)); log.info("MailDoc Recv Insert Success: {}", objectMapper.writeValueAsString(doc));
dynamodbHistoryLogService.insertHistoryLog( dynamodbHistoryLogService.insertHistoryLog(
HISTORYTYPE.LAND_OWNER_CHANGE_MAIL, HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_MAIL,
HISTORYTYPE.LAND_OWNER_CHANGE_MAIL.name(), HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_MAIL.name(),
doc doc
); );
@@ -135,4 +134,72 @@ public class MailJsonRepositoryImpl extends BaseDynamoDBRepository<MailJsonDoc>
exclusiveStartKey exclusiveStartKey
); );
} }
@Override
public void deleteMail(Key key) {
try {
MailJsonDoc beforeDoc = findById(key);
if (beforeDoc != null) {
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());
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_PROCESS_ERROR.getMessage());
}
}
@Override
public void deleteMailItem(Key key, Integer itemId, double count, double newCount) {
try {
MailJsonDoc beforeDoc = findById(key);
if (beforeDoc != null) {
MailJsonDoc afterDoc = deepCopy(beforeDoc, MailJsonDoc.class);
MailJsonAttrib attrib = CommonUtils.stringByObject(afterDoc.getAttribValue(), MailJsonAttrib.class);
List<MailItem> itemList = attrib.getItemList();
MailItem selectItem = itemList.stream()
.filter(item -> item.getItemId().equals(itemId))
.findFirst()
.orElse(null);
if(selectItem == null){
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_MAIL_NOT_ITEM_ERROR.toString());
}
if (count > newCount) {
double updateCount = count - newCount;
selectItem.setCount(updateCount);
} else {
itemList.remove(selectItem);
}
afterDoc.setAttribValue(CommonUtils.objectByString(attrib));
afterDoc.setUpdatedDateTime(CommonUtils.convertUTCDate(LocalDateTime.now()));
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());
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_PROCESS_ERROR.getMessage());
}
}
} }

View File

@@ -1,6 +1,6 @@
package com.caliverse.admin.dynamodb.repository.Impl; package com.caliverse.admin.dynamodb.repository.Impl;
import com.caliverse.admin.domain.entity.HISTORYTYPE; import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
import com.caliverse.admin.domain.entity.Mail; import com.caliverse.admin.domain.entity.Mail;
import com.caliverse.admin.domain.entity.SEARCHTYPE; import com.caliverse.admin.domain.entity.SEARCHTYPE;
import com.caliverse.admin.domain.entity.metadata.MetaSystemMailData; import com.caliverse.admin.domain.entity.metadata.MetaSystemMailData;
@@ -8,7 +8,6 @@ import com.caliverse.admin.dynamodb.domain.atrrib.MailAttrib;
import com.caliverse.admin.dynamodb.domain.atrrib.MailItemAttrib; import com.caliverse.admin.dynamodb.domain.atrrib.MailItemAttrib;
import com.caliverse.admin.dynamodb.domain.doc.MailDoc; import com.caliverse.admin.dynamodb.domain.doc.MailDoc;
import com.caliverse.admin.dynamodb.dto.PageResult; import com.caliverse.admin.dynamodb.dto.PageResult;
import com.caliverse.admin.dynamodb.entity.MailItem;
import com.caliverse.admin.dynamodb.repository.BaseDynamoDBRepository; import com.caliverse.admin.dynamodb.repository.BaseDynamoDBRepository;
import com.caliverse.admin.dynamodb.repository.MailRepository; import com.caliverse.admin.dynamodb.repository.MailRepository;
import com.caliverse.admin.dynamodb.service.DynamoDBOperations; import com.caliverse.admin.dynamodb.service.DynamoDBOperations;
@@ -19,10 +18,11 @@ import com.caliverse.admin.global.common.constants.DynamoDBConstants;
import com.caliverse.admin.global.common.exception.RestApiException; import com.caliverse.admin.global.common.exception.RestApiException;
import com.caliverse.admin.global.common.utils.CommonUtils; import com.caliverse.admin.global.common.utils.CommonUtils;
import com.caliverse.admin.global.common.utils.DateUtils; import com.caliverse.admin.global.common.utils.DateUtils;
import com.caliverse.admin.history.service.DynamodbHistoryLogService; import com.caliverse.admin.mongodb.service.DynamodbHistoryLogService;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import software.amazon.awssdk.enhanced.dynamodb.Key;
import software.amazon.awssdk.services.dynamodb.model.AttributeValue; import software.amazon.awssdk.services.dynamodb.model.AttributeValue;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@@ -83,14 +83,14 @@ public class MailRepositoryImpl extends BaseDynamoDBRepository<MailDoc> implemen
log.info("MailDoc Recv Insert Success: {}", objectMapper.writeValueAsString(doc)); log.info("MailDoc Recv Insert Success: {}", objectMapper.writeValueAsString(doc));
dynamodbHistoryLogService.insertHistoryLog( dynamodbHistoryLogService.insertHistoryLog(
HISTORYTYPE.LAND_OWNER_CHANGE_MAIL, HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_MAIL,
HISTORYTYPE.LAND_OWNER_CHANGE_MAIL.name(), HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_MAIL.name(),
doc doc
); );
}catch (Exception e){ }catch (Exception e){
log.error("insert Error: {}", e.getMessage()); log.error("RECV Mail Insert Error: {}", e.getMessage());
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage()); throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_PROCESS_ERROR.getMessage());
} }
} }
@@ -135,4 +135,72 @@ public class MailRepositoryImpl extends BaseDynamoDBRepository<MailDoc> implemen
exclusiveStartKey exclusiveStartKey
); );
} }
@Override
public void deleteMail(Key key) {
try {
MailDoc beforeDoc = findById(key);
if (beforeDoc != null) {
delete(key);
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());
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_PROCESS_ERROR.getMessage());
}
}
@Override
public void deleteMailItem(Key key, Integer itemId, double count, double newCount) {
try {
MailDoc beforeDoc = findById(key);
if (beforeDoc != null) {
MailDoc afterDoc = deepCopy(beforeDoc, MailDoc.class);
MailAttrib attrib = afterDoc.getAttribValue();
List<MailItemAttrib> itemList = attrib.getItemList();
MailItemAttrib selectItem = itemList.stream()
.filter(item -> item.getItemId().equals(itemId))
.findFirst()
.orElse(null);
if(selectItem == null){
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_MAIL_NOT_ITEM_ERROR.toString());
}
if (count > newCount) {
double updateCount = count - newCount;
selectItem.setCount(updateCount);
} else {
itemList.remove(selectItem);
}
afterDoc.setAttribValue(attrib);
afterDoc.setUpdatedDateTime(CommonUtils.convertUTCDate(LocalDateTime.now()));
update(afterDoc);
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());
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_PROCESS_ERROR.getMessage());
}
}
} }

View File

@@ -6,7 +6,7 @@ import com.caliverse.admin.dynamodb.repository.BaseDynamoDBRepository;
import com.caliverse.admin.dynamodb.repository.MoneyRepository; import com.caliverse.admin.dynamodb.repository.MoneyRepository;
import com.caliverse.admin.dynamodb.service.DynamoDBOperations; import com.caliverse.admin.dynamodb.service.DynamoDBOperations;
import com.caliverse.admin.global.common.constants.DynamoDBConstants; import com.caliverse.admin.global.common.constants.DynamoDBConstants;
import com.caliverse.admin.history.service.DynamodbHistoryLogService; import com.caliverse.admin.mongodb.service.DynamodbHistoryLogService;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;

View File

@@ -1,10 +1,8 @@
package com.caliverse.admin.dynamodb.repository.Impl; package com.caliverse.admin.dynamodb.repository.Impl;
import com.caliverse.admin.domain.entity.HISTORYTYPE; import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
import com.caliverse.admin.dynamodb.domain.atrrib.NicknameAttrib; import com.caliverse.admin.dynamodb.domain.atrrib.NicknameAttrib;
import com.caliverse.admin.dynamodb.domain.atrrib.UserNicknameRegistryAttrib;
import com.caliverse.admin.dynamodb.domain.doc.NicknameDoc; import com.caliverse.admin.dynamodb.domain.doc.NicknameDoc;
import com.caliverse.admin.dynamodb.domain.doc.UserNicknameRegistryDoc;
import com.caliverse.admin.dynamodb.repository.BaseDynamoDBRepository; import com.caliverse.admin.dynamodb.repository.BaseDynamoDBRepository;
import com.caliverse.admin.dynamodb.repository.NicknameRepository; import com.caliverse.admin.dynamodb.repository.NicknameRepository;
import com.caliverse.admin.dynamodb.service.DynamoDBOperations; import com.caliverse.admin.dynamodb.service.DynamoDBOperations;
@@ -13,7 +11,7 @@ import com.caliverse.admin.global.common.code.ErrorCode;
import com.caliverse.admin.global.common.constants.DynamoDBConstants; import com.caliverse.admin.global.common.constants.DynamoDBConstants;
import com.caliverse.admin.global.common.exception.RestApiException; import com.caliverse.admin.global.common.exception.RestApiException;
import com.caliverse.admin.global.common.utils.CommonUtils; import com.caliverse.admin.global.common.utils.CommonUtils;
import com.caliverse.admin.history.service.DynamodbHistoryLogService; import com.caliverse.admin.mongodb.service.DynamodbHistoryLogService;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@@ -71,8 +69,8 @@ public class NicknameRepositoryImpl extends BaseDynamoDBRepository<NicknameDoc>
log.info("NicknameDoc Update Success: {}", objectMapper.writeValueAsString(afterDoc)); log.info("NicknameDoc Update Success: {}", objectMapper.writeValueAsString(afterDoc));
dynamodbHistoryLogService.updateHistoryLog( dynamodbHistoryLogService.updateHistoryLog(
HISTORYTYPE.NICKNAME_UPDATE, HISTORYTYPEDETAIL.NICKNAME_UPDATE,
HISTORYTYPE.NICKNAME_UPDATE.name(), HISTORYTYPEDETAIL.NICKNAME_UPDATE.name(),
beforeDoc, beforeDoc,
afterDoc afterDoc
); );

View File

@@ -1,6 +1,6 @@
package com.caliverse.admin.dynamodb.repository.Impl; package com.caliverse.admin.dynamodb.repository.Impl;
import com.caliverse.admin.domain.entity.HISTORYTYPE; import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
import com.caliverse.admin.dynamodb.domain.atrrib.OwnedBuildingAttrib; import com.caliverse.admin.dynamodb.domain.atrrib.OwnedBuildingAttrib;
import com.caliverse.admin.dynamodb.domain.doc.OwnedBuildingDoc; import com.caliverse.admin.dynamodb.domain.doc.OwnedBuildingDoc;
import com.caliverse.admin.dynamodb.entity.EOwnedType; import com.caliverse.admin.dynamodb.entity.EOwnedType;
@@ -12,8 +12,7 @@ import com.caliverse.admin.global.common.code.CommonCode;
import com.caliverse.admin.global.common.code.ErrorCode; import com.caliverse.admin.global.common.code.ErrorCode;
import com.caliverse.admin.global.common.constants.DynamoDBConstants; import com.caliverse.admin.global.common.constants.DynamoDBConstants;
import com.caliverse.admin.global.common.exception.RestApiException; import com.caliverse.admin.global.common.exception.RestApiException;
import com.caliverse.admin.global.common.utils.CommonUtils; import com.caliverse.admin.mongodb.service.DynamodbHistoryLogService;
import com.caliverse.admin.history.service.DynamodbHistoryLogService;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@@ -73,8 +72,8 @@ public class OwnedBuildingRepositoryImpl extends BaseDynamoDBRepository<OwnedBui
log.info("OwnedBuildingDoc Insert Success: {}", objectMapper.writeValueAsString(doc)); log.info("OwnedBuildingDoc Insert Success: {}", objectMapper.writeValueAsString(doc));
dynamodbHistoryLogService.insertHistoryLog( dynamodbHistoryLogService.insertHistoryLog(
HISTORYTYPE.LAND_OWNER_CHANGE_ADD, HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_ADD,
HISTORYTYPE.LAND_OWNER_CHANGE_ADD.name(), HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_ADD.name(),
doc doc
); );
@@ -99,8 +98,8 @@ public class OwnedBuildingRepositoryImpl extends BaseDynamoDBRepository<OwnedBui
log.info("OwnedBuildingDoc Delete Success: {}", objectMapper.writeValueAsString(doc)); log.info("OwnedBuildingDoc Delete Success: {}", objectMapper.writeValueAsString(doc));
dynamodbHistoryLogService.deleteHistoryLog( dynamodbHistoryLogService.deleteHistoryLog(
HISTORYTYPE.LAND_OWNER_CHANGE_UPDATE, HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_UPDATE,
HISTORYTYPE.LAND_OWNER_CHANGE_UPDATE.name(), HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_UPDATE.name(),
doc doc
); );
}catch (Exception e){ }catch (Exception e){
@@ -124,8 +123,8 @@ public class OwnedBuildingRepositoryImpl extends BaseDynamoDBRepository<OwnedBui
log.info("OwnedBuildingDoc Delete Success: {}", objectMapper.writeValueAsString(doc)); log.info("OwnedBuildingDoc Delete Success: {}", objectMapper.writeValueAsString(doc));
dynamodbHistoryLogService.deleteHistoryLog( dynamodbHistoryLogService.deleteHistoryLog(
HISTORYTYPE.LAND_OWNED_INITIALIZE, HISTORYTYPEDETAIL.LAND_OWNED_INITIALIZE,
HISTORYTYPE.LAND_OWNED_INITIALIZE.name(), HISTORYTYPEDETAIL.LAND_OWNED_INITIALIZE.name(),
doc doc
); );

View File

@@ -1,6 +1,6 @@
package com.caliverse.admin.dynamodb.repository.Impl; package com.caliverse.admin.dynamodb.repository.Impl;
import com.caliverse.admin.domain.entity.HISTORYTYPE; import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
import com.caliverse.admin.dynamodb.domain.atrrib.OwnedLandAttrib; import com.caliverse.admin.dynamodb.domain.atrrib.OwnedLandAttrib;
import com.caliverse.admin.dynamodb.domain.doc.OwnedLandDoc; import com.caliverse.admin.dynamodb.domain.doc.OwnedLandDoc;
import com.caliverse.admin.dynamodb.entity.EOwnedType; import com.caliverse.admin.dynamodb.entity.EOwnedType;
@@ -12,8 +12,7 @@ import com.caliverse.admin.global.common.code.CommonCode;
import com.caliverse.admin.global.common.code.ErrorCode; import com.caliverse.admin.global.common.code.ErrorCode;
import com.caliverse.admin.global.common.constants.DynamoDBConstants; import com.caliverse.admin.global.common.constants.DynamoDBConstants;
import com.caliverse.admin.global.common.exception.RestApiException; import com.caliverse.admin.global.common.exception.RestApiException;
import com.caliverse.admin.global.common.utils.CommonUtils; import com.caliverse.admin.mongodb.service.DynamodbHistoryLogService;
import com.caliverse.admin.history.service.DynamodbHistoryLogService;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@@ -73,8 +72,8 @@ public class OwnedLandRepositoryImpl extends BaseDynamoDBRepository<OwnedLandDoc
log.info("OwnedLandDoc Insert Success: {}", objectMapper.writeValueAsString(doc)); log.info("OwnedLandDoc Insert Success: {}", objectMapper.writeValueAsString(doc));
dynamodbHistoryLogService.insertHistoryLog( dynamodbHistoryLogService.insertHistoryLog(
HISTORYTYPE.LAND_OWNER_CHANGE_ADD, HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_ADD,
HISTORYTYPE.LAND_OWNER_CHANGE_ADD.name(), HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_ADD.name(),
doc doc
); );
@@ -99,8 +98,8 @@ public class OwnedLandRepositoryImpl extends BaseDynamoDBRepository<OwnedLandDoc
log.info("OwnedLandDoc Delete Success: {}", objectMapper.writeValueAsString(doc)); log.info("OwnedLandDoc Delete Success: {}", objectMapper.writeValueAsString(doc));
dynamodbHistoryLogService.deleteHistoryLog( dynamodbHistoryLogService.deleteHistoryLog(
HISTORYTYPE.LAND_OWNER_CHANGE_UPDATE, HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_UPDATE,
HISTORYTYPE.LAND_OWNER_CHANGE_UPDATE.name(), HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_UPDATE.name(),
doc doc
); );
}catch (Exception e){ }catch (Exception e){
@@ -124,8 +123,8 @@ public class OwnedLandRepositoryImpl extends BaseDynamoDBRepository<OwnedLandDoc
log.info("OwnedLandDoc Delete Success: {}", objectMapper.writeValueAsString(doc)); log.info("OwnedLandDoc Delete Success: {}", objectMapper.writeValueAsString(doc));
dynamodbHistoryLogService.deleteHistoryLog( dynamodbHistoryLogService.deleteHistoryLog(
HISTORYTYPE.LAND_OWNER_CHANGE_UPDATE, HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_UPDATE,
HISTORYTYPE.LAND_OWNER_CHANGE_UPDATE.name(), HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_UPDATE.name(),
doc doc
); );
return new DynamodbOperationResult(true, "", doc); return new DynamodbOperationResult(true, "", doc);

View File

@@ -1,7 +1,7 @@
package com.caliverse.admin.dynamodb.repository.Impl; package com.caliverse.admin.dynamodb.repository.Impl;
import com.caliverse.admin.domain.entity.Event; import com.caliverse.admin.domain.entity.Event;
import com.caliverse.admin.domain.entity.HISTORYTYPE; import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
import com.caliverse.admin.domain.entity.Message; import com.caliverse.admin.domain.entity.Message;
import com.caliverse.admin.dynamodb.domain.atrrib.SystemMetaMailAttrib; import com.caliverse.admin.dynamodb.domain.atrrib.SystemMetaMailAttrib;
import com.caliverse.admin.dynamodb.domain.doc.SystemMetaMailDoc; import com.caliverse.admin.dynamodb.domain.doc.SystemMetaMailDoc;
@@ -10,12 +10,10 @@ import com.caliverse.admin.dynamodb.repository.SystemMetaMailRepository;
import com.caliverse.admin.dynamodb.service.DynamoDBOperations; import com.caliverse.admin.dynamodb.service.DynamoDBOperations;
import com.caliverse.admin.global.common.code.CommonCode; import com.caliverse.admin.global.common.code.CommonCode;
import com.caliverse.admin.global.common.code.ErrorCode; import com.caliverse.admin.global.common.code.ErrorCode;
import com.caliverse.admin.global.common.constants.CommonConstants;
import com.caliverse.admin.global.common.constants.DynamoDBConstants; import com.caliverse.admin.global.common.constants.DynamoDBConstants;
import com.caliverse.admin.global.common.exception.RestApiException; import com.caliverse.admin.global.common.exception.RestApiException;
import com.caliverse.admin.global.common.utils.CommonUtils;
import com.caliverse.admin.global.common.utils.DynamodbUtil; import com.caliverse.admin.global.common.utils.DynamodbUtil;
import com.caliverse.admin.history.service.DynamodbHistoryLogService; import com.caliverse.admin.mongodb.service.DynamodbHistoryLogService;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@@ -61,8 +59,8 @@ public class SystemMetaMailRepositoryImpl extends BaseDynamoDBRepository<SystemM
save(doc); save(doc);
dynamodbHistoryLogService.insertHistoryLog( dynamodbHistoryLogService.insertHistoryLog(
HISTORYTYPE.EVENT_ADD, HISTORYTYPEDETAIL.EVENT_ADD,
HISTORYTYPE.EVENT_ADD.name(), HISTORYTYPEDETAIL.EVENT_ADD.name(),
doc doc
); );

View File

@@ -5,13 +5,9 @@ import com.caliverse.admin.dynamodb.domain.doc.UserBaseDoc;
import com.caliverse.admin.dynamodb.repository.BaseDynamoDBRepository; import com.caliverse.admin.dynamodb.repository.BaseDynamoDBRepository;
import com.caliverse.admin.dynamodb.repository.UserBaseRepository; import com.caliverse.admin.dynamodb.repository.UserBaseRepository;
import com.caliverse.admin.dynamodb.service.DynamoDBOperations; import com.caliverse.admin.dynamodb.service.DynamoDBOperations;
import com.caliverse.admin.global.common.code.CommonCode;
import com.caliverse.admin.global.common.code.ErrorCode;
import com.caliverse.admin.global.common.constants.DynamoDBConstants; import com.caliverse.admin.global.common.constants.DynamoDBConstants;
import com.caliverse.admin.global.common.exception.RestApiException;
import com.caliverse.admin.global.common.utils.CommonUtils; import com.caliverse.admin.global.common.utils.CommonUtils;
import com.caliverse.admin.history.service.DynamodbHistoryLogService; import com.caliverse.admin.mongodb.service.DynamodbHistoryLogService;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;

View File

@@ -1,10 +1,7 @@
package com.caliverse.admin.dynamodb.repository.Impl; package com.caliverse.admin.dynamodb.repository.Impl;
import com.caliverse.admin.domain.entity.HISTORYTYPE; import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
import com.caliverse.admin.dynamodb.domain.atrrib.AccountBaseAttrib;
import com.caliverse.admin.dynamodb.domain.atrrib.LandAuctionRegistryAttrib;
import com.caliverse.admin.dynamodb.domain.atrrib.UserNicknameRegistryAttrib; import com.caliverse.admin.dynamodb.domain.atrrib.UserNicknameRegistryAttrib;
import com.caliverse.admin.dynamodb.domain.doc.LandAuctionRegistryDoc;
import com.caliverse.admin.dynamodb.domain.doc.UserNicknameRegistryDoc; import com.caliverse.admin.dynamodb.domain.doc.UserNicknameRegistryDoc;
import com.caliverse.admin.dynamodb.repository.BaseDynamoDBRepository; import com.caliverse.admin.dynamodb.repository.BaseDynamoDBRepository;
import com.caliverse.admin.dynamodb.repository.UserNicknameRegistryRepository; import com.caliverse.admin.dynamodb.repository.UserNicknameRegistryRepository;
@@ -14,7 +11,7 @@ import com.caliverse.admin.global.common.code.ErrorCode;
import com.caliverse.admin.global.common.constants.DynamoDBConstants; import com.caliverse.admin.global.common.constants.DynamoDBConstants;
import com.caliverse.admin.global.common.exception.RestApiException; import com.caliverse.admin.global.common.exception.RestApiException;
import com.caliverse.admin.global.common.utils.CommonUtils; import com.caliverse.admin.global.common.utils.CommonUtils;
import com.caliverse.admin.history.service.DynamodbHistoryLogService; import com.caliverse.admin.mongodb.service.DynamodbHistoryLogService;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
@@ -110,8 +107,8 @@ public class UserNicknameRegistryRepositoryImpl extends BaseDynamoDBRepository<U
log.info("UserNicknameRegistryDoc Delete Success: {}", objectMapper.writeValueAsString(beforeDoc)); log.info("UserNicknameRegistryDoc Delete Success: {}", objectMapper.writeValueAsString(beforeDoc));
dynamodbHistoryLogService.deleteHistoryLog( dynamodbHistoryLogService.deleteHistoryLog(
HISTORYTYPE.NICKNAME_REGISTRY_DELETE, HISTORYTYPEDETAIL.NICKNAME_REGISTRY_DELETE,
HISTORYTYPE.NICKNAME_REGISTRY_DELETE.name(), HISTORYTYPEDETAIL.NICKNAME_REGISTRY_DELETE.name(),
beforeDoc beforeDoc
); );
} }
@@ -142,8 +139,8 @@ public class UserNicknameRegistryRepositoryImpl extends BaseDynamoDBRepository<U
log.info("UserNicknameRegistryDoc Insert Success: {}", objectMapper.writeValueAsString(afterDoc)); log.info("UserNicknameRegistryDoc Insert Success: {}", objectMapper.writeValueAsString(afterDoc));
dynamodbHistoryLogService.insertHistoryLog( dynamodbHistoryLogService.insertHistoryLog(
HISTORYTYPE.NICKNAME_REGISTRY_ADD, HISTORYTYPEDETAIL.NICKNAME_REGISTRY_ADD,
HISTORYTYPE.NICKNAME_REGISTRY_ADD.name(), HISTORYTYPEDETAIL.NICKNAME_REGISTRY_ADD.name(),
afterDoc afterDoc
); );
} }

View File

@@ -7,6 +7,7 @@ import com.caliverse.admin.dynamodb.domain.doc.MailDoc;
import com.caliverse.admin.dynamodb.domain.doc.MailJsonDoc; import com.caliverse.admin.dynamodb.domain.doc.MailJsonDoc;
import com.caliverse.admin.dynamodb.dto.PageResult; import com.caliverse.admin.dynamodb.dto.PageResult;
import com.caliverse.admin.dynamodb.entity.MailItem; import com.caliverse.admin.dynamodb.entity.MailItem;
import software.amazon.awssdk.enhanced.dynamodb.Key;
import software.amazon.awssdk.services.dynamodb.model.AttributeValue; import software.amazon.awssdk.services.dynamodb.model.AttributeValue;
import java.util.List; import java.util.List;
@@ -22,4 +23,6 @@ public interface MailJsonRepository extends DynamoDBRepository<MailJsonDoc> {
String sortKeyPrefix, String sortKeyPrefix,
Map<String, AttributeValue> exclusiveStartKey Map<String, AttributeValue> exclusiveStartKey
); );
void deleteMail(Key key);
void deleteMailItem(Key key, Integer itemId, double count, double newCount);
} }

View File

@@ -9,6 +9,7 @@ import com.caliverse.admin.dynamodb.domain.doc.MailDoc;
import com.caliverse.admin.dynamodb.domain.doc.MailJsonDoc; import com.caliverse.admin.dynamodb.domain.doc.MailJsonDoc;
import com.caliverse.admin.dynamodb.dto.PageResult; import com.caliverse.admin.dynamodb.dto.PageResult;
import com.caliverse.admin.dynamodb.entity.MailItem; import com.caliverse.admin.dynamodb.entity.MailItem;
import software.amazon.awssdk.enhanced.dynamodb.Key;
import software.amazon.awssdk.services.dynamodb.model.AttributeValue; import software.amazon.awssdk.services.dynamodb.model.AttributeValue;
import java.util.List; import java.util.List;
@@ -24,4 +25,6 @@ public interface MailRepository extends DynamoDBRepository<MailDoc> {
String sortKeyPrefix, String sortKeyPrefix,
Map<String, AttributeValue> exclusiveStartKey Map<String, AttributeValue> exclusiveStartKey
); );
void deleteMail(Key key);
void deleteMailItem(Key key, Integer itemId, double count, double newCount);
} }

View File

@@ -5,12 +5,11 @@ import com.caliverse.admin.domain.entity.metadata.MetaLandData;
import com.caliverse.admin.domain.service.LandService; import com.caliverse.admin.domain.service.LandService;
import com.caliverse.admin.dynamodb.domain.atrrib.LandAttrib; import com.caliverse.admin.dynamodb.domain.atrrib.LandAttrib;
import com.caliverse.admin.dynamodb.domain.atrrib.LandAuctionRegistryAttrib; import com.caliverse.admin.dynamodb.domain.atrrib.LandAuctionRegistryAttrib;
import com.caliverse.admin.dynamodb.domain.doc.LandAuctionRefundBidPriceDoc;
import com.caliverse.admin.dynamodb.domain.doc.LandAuctionRegistryDoc; import com.caliverse.admin.dynamodb.domain.doc.LandAuctionRegistryDoc;
import com.caliverse.admin.dynamodb.repository.*; import com.caliverse.admin.dynamodb.repository.*;
import com.caliverse.admin.global.common.constants.DynamoDBConstants; import com.caliverse.admin.global.common.constants.DynamoDBConstants;
import com.caliverse.admin.global.component.transaction.TransactionIdManager; import com.caliverse.admin.global.component.transaction.TransactionIdManager;
import com.caliverse.admin.history.service.DataInitializeHistoryService; import com.caliverse.admin.mongodb.service.DataInitializeHistoryService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;

View File

@@ -93,6 +93,57 @@ public class DynamodbItemService {
.build(); .build();
} }
public UsersResponse.InventoryInfo getClothItems(String guid){
List<UsersResponse.Item> clothList = new ArrayList<>();
List<UsersResponse.Item> propList = new ArrayList<>();
List<UsersResponse.Item> beautyList = new ArrayList<>();
List<UsersResponse.Item> tattooList = new ArrayList<>();
List<UsersResponse.Item> currencyList = new ArrayList<>();
List<UsersResponse.Item> etcList = new ArrayList<>();
Map<String, AttributeValue> pageKey = null;
do {
PageResult<ItemDoc> itemList = itemRepository.getItemListWithPaging(guid, "", DynamoDBConstants.ATTRIB_ITEM, EFilterOperator.CONTAINS,"\"equiped_inven_type\":0", pageKey, false);
itemList.getItems().forEach(item -> {
ItemAttrib attrib = CommonUtils.stringByObject(item.getAttribValue(), ItemAttrib.class);
int item_id = attrib.getItemMetaId();
String item_name = metaDataHandler.getTextStringData(metaDataHandler.getMetaItemNameData(item_id));
String item_type = metaDataHandler.getMetaItemLargeTypeData(item_id);
UsersResponse.Item inventory = UsersResponse.Item.builder()
.itemId(item_id)
.itemName(item_name)
.count(attrib.getItemStackCount())
.itemGuid(attrib.getItemGuid())
.build();
if(item_type.isEmpty()) {
etcList.add(inventory);
}else{
switch (ITEMLARGETYPE.valueOf(item_type)){
case CLOTH -> clothList.add(inventory);
case PROP -> propList.add(inventory);
case BEAUTY -> beautyList.add(inventory);
case TATTOO -> tattooList.add(inventory);
case CURRENCY -> currencyList.add(inventory);
default -> etcList.add(inventory);
}}
});
pageKey = itemList.getLastEvaluatedKey();
} while (pageKey != null);
return UsersResponse.InventoryInfo.builder()
.cloth(clothList)
.prop(propList)
.beauty(beautyList)
.tattoo(tattooList)
.currency(currencyList)
.etc(etcList)
.build();
}
@DynamoDBTransaction @DynamoDBTransaction
public void updateItemStack(String guid, String itemGuid, int stackCount){ public void updateItemStack(String guid, String itemGuid, int stackCount){
itemRepository.updateItemStack(guid, itemGuid, stackCount); itemRepository.updateItemStack(guid, itemGuid, stackCount);

View File

@@ -2,7 +2,6 @@ package com.caliverse.admin.dynamodb.service;
import com.caliverse.admin.domain.entity.EInitDataType; import com.caliverse.admin.domain.entity.EInitDataType;
import com.caliverse.admin.domain.entity.LandAuction; import com.caliverse.admin.domain.entity.LandAuction;
import com.caliverse.admin.domain.entity.metadata.MetaLandData;
import com.caliverse.admin.domain.request.LandRequest; import com.caliverse.admin.domain.request.LandRequest;
import com.caliverse.admin.dynamodb.domain.atrrib.LandAuctionRefundBidPriceAttrib; import com.caliverse.admin.dynamodb.domain.atrrib.LandAuctionRefundBidPriceAttrib;
import com.caliverse.admin.dynamodb.domain.doc.DynamoDBDocBase; import com.caliverse.admin.dynamodb.domain.doc.DynamoDBDocBase;
@@ -15,7 +14,7 @@ import com.caliverse.admin.dynamodb.domain.atrrib.LandAuctionHighestBidUserAttri
import com.caliverse.admin.dynamodb.domain.atrrib.LandAuctionRegistryAttrib; import com.caliverse.admin.dynamodb.domain.atrrib.LandAuctionRegistryAttrib;
import com.caliverse.admin.global.common.constants.DynamoDBConstants; import com.caliverse.admin.global.common.constants.DynamoDBConstants;
import com.caliverse.admin.global.component.transaction.TransactionIdManager; import com.caliverse.admin.global.component.transaction.TransactionIdManager;
import com.caliverse.admin.history.service.DataInitializeHistoryService; import com.caliverse.admin.mongodb.service.DataInitializeHistoryService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -95,7 +94,7 @@ public class DynamodbLandAuctionService {
if(registryResult.isSuccess()){ if(registryResult.isSuccess()){
if(registryResult.getData() != null) dataList.add(registryResult.getData()); if(registryResult.getData() != null) dataList.add(registryResult.getData());
}else{ }else{
historySave(EInitDataType.LandAuction, tranId, false, registryResult.getMessage(), dataList, map); historySave(EInitDataType.LandAuction, false, registryResult.getMessage(), dataList, map);
throw new RuntimeException(registryResult.getMessage()); throw new RuntimeException(registryResult.getMessage());
} }
@@ -103,7 +102,7 @@ public class DynamodbLandAuctionService {
if(activityResult.isSuccess()){ if(activityResult.isSuccess()){
if(activityResult.getData() != null) dataList.add(activityResult.getData()); if(activityResult.getData() != null) dataList.add(activityResult.getData());
}else{ }else{
historySave(EInitDataType.LandAuction, tranId, false, activityResult.getMessage(), dataList, map); historySave(EInitDataType.LandAuction, false, activityResult.getMessage(), dataList, map);
throw new RuntimeException(activityResult.getMessage()); throw new RuntimeException(activityResult.getMessage());
} }
@@ -111,7 +110,7 @@ public class DynamodbLandAuctionService {
if(highestBidUserResult.isSuccess()){ if(highestBidUserResult.isSuccess()){
if(highestBidUserResult.getData() != null) dataList.add(highestBidUserResult.getData()); if(highestBidUserResult.getData() != null) dataList.add(highestBidUserResult.getData());
}else{ }else{
historySave(EInitDataType.LandAuction, tranId, false, highestBidUserResult.getMessage(), dataList, map); historySave(EInitDataType.LandAuction, false, highestBidUserResult.getMessage(), dataList, map);
throw new RuntimeException(highestBidUserResult.getMessage()); throw new RuntimeException(highestBidUserResult.getMessage());
} }
@@ -119,7 +118,7 @@ public class DynamodbLandAuctionService {
if(recordResult.isSuccess()){ if(recordResult.isSuccess()){
if(recordResult.getData() != null) dataList.add(recordResult.getData()); if(recordResult.getData() != null) dataList.add(recordResult.getData());
}else{ }else{
historySave(EInitDataType.LandAuction, tranId, false, recordResult.getMessage(), dataList, map); historySave(EInitDataType.LandAuction, false, recordResult.getMessage(), dataList, map);
throw new RuntimeException(recordResult.getMessage()); throw new RuntimeException(recordResult.getMessage());
} }
if(guid != null && !guid.isEmpty()) { if(guid != null && !guid.isEmpty()) {
@@ -128,7 +127,7 @@ public class DynamodbLandAuctionService {
if (refundBidPriceResult.isSuccess()) { if (refundBidPriceResult.isSuccess()) {
if (refundBidPriceResult.getData() != null) dataList.add(refundBidPriceResult.getData()); if (refundBidPriceResult.getData() != null) dataList.add(refundBidPriceResult.getData());
} else { } else {
historySave(EInitDataType.LandAuction, tranId, false, refundBidPriceResult.getMessage(), dataList, map); historySave(EInitDataType.LandAuction, false, refundBidPriceResult.getMessage(), dataList, map);
throw new RuntimeException(refundBidPriceResult.getMessage()); throw new RuntimeException(refundBidPriceResult.getMessage());
} }
}else{ }else{
@@ -142,28 +141,28 @@ public class DynamodbLandAuctionService {
if (refundBidPriceResult.isSuccess()) { if (refundBidPriceResult.isSuccess()) {
if (refundBidPriceResult.getData() != null) dataList.add(refundBidPriceResult.getData()); if (refundBidPriceResult.getData() != null) dataList.add(refundBidPriceResult.getData());
} else { } else {
historySave(EInitDataType.LandAuction, tranId, false, refundBidPriceResult.getMessage(), dataList, map); historySave(EInitDataType.LandAuction, false, refundBidPriceResult.getMessage(), dataList, map);
throw new RuntimeException(refundBidPriceResult.getMessage()); throw new RuntimeException(refundBidPriceResult.getMessage());
} }
}); });
} }
historySave(EInitDataType.LandAuction, tranId, true, "", dataList, map); historySave(EInitDataType.LandAuction, true, "", dataList, map);
}catch (Exception e){ }catch (Exception e){
historySave(EInitDataType.LandAuction, tranId, false, e.getMessage(), null, map); historySave(EInitDataType.LandAuction, false, e.getMessage(), null, map);
throw new RuntimeException(e.getMessage()); throw new RuntimeException(e.getMessage());
} }
} }
private void historySave(EInitDataType dataType, String tranId, boolean isSuccess, String msg, List<DynamoDBDocBase> dataList, Map map){ private void historySave(EInitDataType dataType, boolean isSuccess, String msg, List<DynamoDBDocBase> dataList, Map map){
if(dataList != null && !dataList.isEmpty()) { if(dataList != null && !dataList.isEmpty()) {
dataList.forEach(data -> { dataList.forEach(data -> {
if(data != null) if(data != null)
dataInitializeHistoryService.dynamodbDataInitHistory(dataType, tranId, isSuccess, msg, data, map); dataInitializeHistoryService.dynamodbDataInitHistory(dataType, isSuccess, msg, data, map);
}); });
}else{ }else{
dataInitializeHistoryService.dynamodbDataInitHistory(dataType, tranId, isSuccess, msg, null, map); dataInitializeHistoryService.dynamodbDataInitHistory(dataType, isSuccess, msg, null, map);
} }
} }
} }

View File

@@ -15,7 +15,7 @@ import com.caliverse.admin.dynamodb.repository.OwnedLandRepository;
import com.caliverse.admin.global.common.annotation.DynamoDBTransaction; import com.caliverse.admin.global.common.annotation.DynamoDBTransaction;
import com.caliverse.admin.global.common.constants.DynamoDBConstants; import com.caliverse.admin.global.common.constants.DynamoDBConstants;
import com.caliverse.admin.global.component.transaction.TransactionIdManager; import com.caliverse.admin.global.component.transaction.TransactionIdManager;
import com.caliverse.admin.history.service.DataInitializeHistoryService; import com.caliverse.admin.mongodb.service.DataInitializeHistoryService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -170,10 +170,10 @@ public class DynamodbLandService {
if(!dataList.isEmpty()) { if(!dataList.isEmpty()) {
dataList.forEach(data -> { dataList.forEach(data -> {
if (data != null) if (data != null)
dataInitializeHistoryService.dynamodbDataInitHistory(dataType, tranId, isSuccess, msg, data, map); dataInitializeHistoryService.dynamodbDataInitHistory(dataType, isSuccess, msg, data, map);
}); });
}else{ }else{
dataInitializeHistoryService.dynamodbDataInitHistory(dataType, tranId, isSuccess, msg, null, map); dataInitializeHistoryService.dynamodbDataInitHistory(dataType, isSuccess, msg, null, map);
} }
} }
} }

View File

@@ -0,0 +1,145 @@
package com.caliverse.admin.dynamodb.service;
import com.caliverse.admin.Indicators.entity.MoneyLogInfo;
import com.caliverse.admin.domain.datacomponent.MetaDataHandler;
import com.caliverse.admin.domain.entity.Event;
import com.caliverse.admin.domain.entity.SEARCHTYPE;
import com.caliverse.admin.domain.entity.metadata.MetaLandData;
import com.caliverse.admin.domain.entity.metadata.MetaSystemMailData;
import com.caliverse.admin.domain.request.LandRequest;
import com.caliverse.admin.dynamodb.domain.atrrib.*;
import com.caliverse.admin.dynamodb.domain.doc.MailDoc;
import com.caliverse.admin.dynamodb.domain.doc.MailJsonDoc;
import com.caliverse.admin.dynamodb.dto.PageResult;
import com.caliverse.admin.dynamodb.entity.KeyParam;
import com.caliverse.admin.dynamodb.repository.*;
import com.caliverse.admin.global.common.annotation.DynamoDBTransaction;
import com.caliverse.admin.global.common.constants.AdminConstants;
import com.caliverse.admin.global.common.constants.CommonConstants;
import com.caliverse.admin.global.common.constants.DynamoDBConstants;
import com.caliverse.admin.global.common.utils.CommonUtils;
import com.caliverse.admin.logs.Indicatordomain.StartEndTime;
import com.caliverse.admin.logs.logservice.LogServiceHelper;
import com.caliverse.admin.logs.logservice.indicators.IndicatorsMoneyService;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import software.amazon.awssdk.enhanced.dynamodb.Key;
import software.amazon.awssdk.services.dynamodb.model.AttributeValue;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Slf4j
@Service
@RequiredArgsConstructor
public class DynamodbMailService {
private final SystemMetaMailRepository systemMetaMailRepository;
private final MailRepository mailRepository;
private final MailJsonRepository mailJsonRepository;
private final MetaDataHandler metaDataHandler;
@DynamoDBTransaction
public void insertSystemMail(Event event){
systemMetaMailRepository.insert(event);
}
@DynamoDBTransaction
public void insertLandChangesMail(LandRequest landRequest){
MetaSystemMailData systemMailData = metaDataHandler.getMetaSystemMailListData().stream()
.filter(data -> data.getKey().equals(CommonConstants.SYSTEM_MAIL_LAND_TRANS_KEY)).findFirst().orElse(null);
MetaLandData landData = metaDataHandler.getMetaLandData(landRequest.getLandId());
List<String> arguments = new ArrayList<>();
arguments.add(landRequest.getUserName());
arguments.add(landData.getLandName());
String guid = landRequest.getUserGuid();
String nickname = landRequest.getUserName();
List<MailItemAttrib> items = new ArrayList<>();
items.add(MailItemAttrib.builder()
.itemId(landData.getLinkedItem())
.count(1.0)
.productId(0)
.isRepeatProduct(CommonConstants.FALSE)
.build()
);
mailRepository.insertRecvSystemMail(guid, nickname, items, systemMailData, arguments);
}
public PageResult<MailDoc> getMail(SEARCHTYPE type, String guid, String sortKey, KeyParam pageKey){
Map<String, AttributeValue> pagingKey = null;
if(pageKey != null){
pagingKey = new HashMap<>();
pagingKey.put(DynamoDBConstants.PK_KEY_NAME, AttributeValue.builder().s(pageKey.getPk()).build());
pagingKey.put(DynamoDBConstants.SK_KEY_NAME, AttributeValue.builder().s(pageKey.getSk()).build());
}
PageResult<MailDoc> mailList = mailRepository.getMailListWithPaging(type, guid, sortKey, pagingKey);
return mailList;
}
public MailJsonAttrib getMailJsonAttrib(String pk, String sk){
try {
Key key = Key.builder()
.partitionValue(pk)
.sortValue(sk)
.build();
MailJsonDoc mailDoc = mailJsonRepository.findById(key);
return CommonUtils.stringByObject(mailDoc.getAttribValue(), MailJsonAttrib.class);
}catch (Exception e){
log.error(e.getMessage());
}
return null;
}
@DynamoDBTransaction
public void deleteMail(String type, String userGuid, String mailGuid){
Key key;
if(type.equals("SEND")){
key = Key.builder()
.partitionValue(DynamoDBConstants.PK_KEY_SENT_MAIL + userGuid)
.sortValue(mailGuid)
.build();
}else{
key = Key.builder()
.partitionValue(DynamoDBConstants.PK_KEY_RECV_MAIL + userGuid)
.sortValue(mailGuid)
.build();
}
MailDoc mailDoc = mailRepository.findById(key);
MailAttrib attrib = mailDoc.getAttribValue();
if(attrib == null){
mailJsonRepository.deleteMail(key);
}else{
mailRepository.deleteMail(key);
}
}
@DynamoDBTransaction
public void deleteMailItem(String type, String userGuid, String mailGuid, Integer itemId, double count, double newCount){
Key key;
if(type.equals("SEND")){
key = Key.builder()
.partitionValue(DynamoDBConstants.PK_KEY_SENT_MAIL + userGuid)
.sortValue(mailGuid)
.build();
}else{
key = Key.builder()
.partitionValue(DynamoDBConstants.PK_KEY_RECV_MAIL + userGuid)
.sortValue(mailGuid)
.build();
}
MailDoc mailDoc = mailRepository.findById(key);
MailAttrib attrib = mailDoc.getAttribValue();
if(attrib == null){
mailJsonRepository.deleteMailItem(key, itemId, count, newCount);
}else{
mailRepository.deleteMailItem(key, itemId, count, newCount);
}
}
}

View File

@@ -52,7 +52,6 @@ public class DynamodbService {
private final IndicatorsMoneyService moneyService; private final IndicatorsMoneyService moneyService;
private final ObjectMapper mapper = new ObjectMapper();
private final MetaDataHandler metaDataHandler; private final MetaDataHandler metaDataHandler;
public void saveUserMoney(){ public void saveUserMoney(){
@@ -72,58 +71,4 @@ public class DynamodbService {
log.error(e.getMessage()); log.error(e.getMessage());
} }
} }
@DynamoDBTransaction
public void insertSystemMail(Event event){
systemMetaMailRepository.insert(event);
}
@DynamoDBTransaction
public void insertLandChangesMail(LandRequest landRequest){
MetaSystemMailData systemMailData = metaDataHandler.getMetaSystemMailListData().stream()
.filter(data -> data.getKey().equals(CommonConstants.SYSTEM_MAIL_LAND_TRANS_KEY)).findFirst().orElse(null);
MetaLandData landData = metaDataHandler.getMetaLandData(landRequest.getLandId());
List<String> arguments = new ArrayList<>();
arguments.add(landRequest.getUserName());
arguments.add(landData.getLandName());
String guid = landRequest.getUserGuid();
String nickname = landRequest.getUserName();
List<MailItemAttrib> items = new ArrayList<>();
items.add(MailItemAttrib.builder()
.itemId(landData.getLinkedItem())
.count(1.0)
.productId(0)
.isRepeatProduct(CommonConstants.FALSE)
.build()
);
mailRepository.insertRecvSystemMail(guid, nickname, items, systemMailData, arguments);
}
public PageResult<MailDoc> getMail(SEARCHTYPE type, String guid, String sortKey, KeyParam pageKey){
Map<String, AttributeValue> pagingKey = null;
if(pageKey != null){
pagingKey = new HashMap<>();
pagingKey.put(DynamoDBConstants.PK_KEY_NAME, AttributeValue.builder().s(pageKey.getPk()).build());
pagingKey.put(DynamoDBConstants.SK_KEY_NAME, AttributeValue.builder().s(pageKey.getSk()).build());
}
PageResult<MailDoc> mailList = mailRepository.getMailListWithPaging(type, guid, sortKey, pagingKey);
return mailList;
}
public MailJsonAttrib getMailJsonAttrib(String pk, String sk){
try {
Key key = Key.builder()
.partitionValue(pk)
.sortValue(sk)
.build();
MailJsonDoc mailDoc = mailJsonRepository.findById(key);
return CommonUtils.stringByObject(mailDoc.getAttribValue(), MailJsonAttrib.class);
}catch (Exception e){
log.error(e.getMessage());
}
return null;
}
} }

View File

@@ -14,6 +14,7 @@ public enum ErrorCode {
USER_GAME_LOGIN_JSON_MAPPER_PARSE_ERROR("유저 게임세션 데이터 파싱하는 도중 에러가 발생했습니다."), USER_GAME_LOGIN_JSON_MAPPER_PARSE_ERROR("유저 게임세션 데이터 파싱하는 도중 에러가 발생했습니다."),
JSON_PARSE_ERROR("데이터 파싱 에러"), JSON_PARSE_ERROR("데이터 파싱 에러"),
NOT_USER("존재하지 않는 유저입니다."),
WRONG_TYPE_TOKEN("잘못된 타입의 토큰입니다."), WRONG_TYPE_TOKEN("잘못된 타입의 토큰입니다."),
EXPIRED_TOKEN("만료된 토큰입니다."), EXPIRED_TOKEN("만료된 토큰입니다."),
PWD_EXPIRATION("비밀번호 기간 만료"), PWD_EXPIRATION("비밀번호 기간 만료"),
@@ -118,6 +119,8 @@ public enum ErrorCode {
DYNAMODB_ITEM_DELETE_ERROR("아이템 삭제 중 오류가 발생하였습니다."), DYNAMODB_ITEM_DELETE_ERROR("아이템 삭제 중 오류가 발생하였습니다."),
DYNAMODB_ITEM_UPDATE_ERROR("아이템 수정 중 오류가 발생하였습니다."), DYNAMODB_ITEM_UPDATE_ERROR("아이템 수정 중 오류가 발생하였습니다."),
DYNAMODB_MAIL_NOT_ITEM_ERROR("우편에 해당 아이템이 존재하지 않습니다."),
SENDMAIL_ERROR("메일 발송중 오류가 발생하였습니다. 관리자에게 문의주세요."), SENDMAIL_ERROR("메일 발송중 오류가 발생하였습니다. 관리자에게 문의주세요."),
EXCEPTION_INVALID_PROTOCOL_BUFFER_EXCEPTION_ERROR("InvalidProtocolBufferException"), EXCEPTION_INVALID_PROTOCOL_BUFFER_EXCEPTION_ERROR("InvalidProtocolBufferException"),

View File

@@ -14,6 +14,7 @@ public class AdminConstants {
public static final String MONGO_DB_COLLECTION_METAVER_SERVER = "metaverseserver"; public static final String MONGO_DB_COLLECTION_METAVER_SERVER = "metaverseserver";
public static final String MONGO_DB_COLLECTION_LOG = "Log"; public static final String MONGO_DB_COLLECTION_LOG = "Log";
public static final String MONGO_DB_COLLECTION_DATA_INIT_HISTORY = "dataInitHistory"; public static final String MONGO_DB_COLLECTION_DATA_INIT_HISTORY = "dataInitHistory";
public static final String MONGO_DB_COLLECTION_API_LOG = "apiLog";
public static final String MONGO_DB_COLLECTION_HISTORY_LOG = "historyLog"; public static final String MONGO_DB_COLLECTION_HISTORY_LOG = "historyLog";
public static final String MONGO_DB_KEY_LOGTIME = "logTime"; public static final String MONGO_DB_KEY_LOGTIME = "logTime";
@@ -22,9 +23,10 @@ public class AdminConstants {
public static final String MONGO_DB_KEY_LOGHOUR = "logHour"; public static final String MONGO_DB_KEY_LOGHOUR = "logHour";
public static final String MONGO_DB_KEY_LOGMINUTE = "logMinute"; public static final String MONGO_DB_KEY_LOGMINUTE = "logMinute";
public static final String MONGO_DB_KEY_TIMESTAMP = "timestamp"; public static final String MONGO_DB_KEY_TIMESTAMP = "timestamp";
public static final String MONGO_DB_KEY_MESSAGE = "message"; public static final String MONGO_DB_KEY_MESSAGE = "message";
public static final String MONGO_DB_KEY_DB_TYPE = "dbType"; public static final String MONGO_DB_KEY_DB_TYPE = "dbType";
public static final String MONGO_DB_KEY_BODY = "body";
public static final String MONGO_DB_KEY_TABLE_NAME = "tableName";
public static final String MONGO_DB_KEY_USER_GUID = "userGuid"; public static final String MONGO_DB_KEY_USER_GUID = "userGuid";
public static final String MONGO_DB_KEY_USER_NICKNAME = "userNickname"; public static final String MONGO_DB_KEY_USER_NICKNAME = "userNickname";
@@ -39,6 +41,8 @@ public class AdminConstants {
public static final String MONGO_DB_KEY_SERVER_TYPE = "serverType"; public static final String MONGO_DB_KEY_SERVER_TYPE = "serverType";
public static final String MONGO_DB_KEY_CREATE_TIME = "createdTime"; public static final String MONGO_DB_KEY_CREATE_TIME = "createdTime";
public static final String MONGO_DB_KEY_IP = "ip"; public static final String MONGO_DB_KEY_IP = "ip";
public static final String MONGO_DB_KEY_HISTORY_TYPE = "historyType";
public static final String MONGO_DB_KEY_USER_ID = "userId";
public static final String MONGO_DB_KEY_USER_GUID_LIST = "userGuidList"; public static final String MONGO_DB_KEY_USER_GUID_LIST = "userGuidList";
public static final String MONGO_DB_KEY_USER_GUID_LIST_COUNT = "userGuidListCount"; public static final String MONGO_DB_KEY_USER_GUID_LIST_COUNT = "userGuidListCount";
@@ -56,6 +60,8 @@ public class AdminConstants {
public static final String REGEX_MSG_CHARACTER_CREATE = "\"Action\":\"CharacterCreate\""; public static final String REGEX_MSG_CHARACTER_CREATE = "\"Action\":\"CharacterCreate\"";
public static final String REGEX_MSG_PLAY_TIME = "\"Action\":\"UserLogout\""; public static final String REGEX_MSG_PLAY_TIME = "\"Action\":\"UserLogout\"";
public static final String REGEX_MSG_UGQ_CREATE = "\"Action\":\"UgqApiQuestCraete\""; public static final String REGEX_MSG_UGQ_CREATE = "\"Action\":\"UgqApiQuestCraete\"";
public static final String REGEX_MSG_ACTION = "\"Action\":\"%s\"";
public static final String REGEX_MSG_DOMAIN = "\"Domain\":\"%s\"";
public static final int STAT_DAY_NUM = 1; public static final int STAT_DAY_NUM = 1;
public static final int STAT_WEEK_NUM = 7; public static final int STAT_WEEK_NUM = 7;

View File

@@ -20,6 +20,7 @@ public class CommonConstants {
public static final String GUID = "GUID"; public static final String GUID = "GUID";
public static final String NICKNAME = "NICKNAME"; public static final String NICKNAME = "NICKNAME";
public static final String EMAIL = "EMAIL"; public static final String EMAIL = "EMAIL";
public static final String SYSTEM = "SYSTEM";
public static final String FORMAT_DATE_ISO_DATETIME_MILLIS = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"; public static final String FORMAT_DATE_ISO_DATETIME_MILLIS = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'";
public static final String FORMAT_DATE_ISO_DATETIME_MILLIS_NANO = "yyyy-MM-dd'T'HH:mm:ss.SSSSSSS'Z'"; public static final String FORMAT_DATE_ISO_DATETIME_MILLIS_NANO = "yyyy-MM-dd'T'HH:mm:ss.SSSSSSS'Z'";

View File

@@ -6,8 +6,10 @@ public class MysqlConstants {
public static String TABLE_NAME_CALIUM_REQUEST = "calium_request"; public static String TABLE_NAME_CALIUM_REQUEST = "calium_request";
public static String TABLE_NAME_EVENT = "event"; public static String TABLE_NAME_EVENT = "event";
public static String TABLE_NAME_MENU_BANNER = "menu_banner"; public static String TABLE_NAME_MENU_BANNER = "menu_banner";
public static String TABLE_NAME_USER_BLOCK = "black_list";
public static String TABLE_NAME_MAIL = "mail"; public static String TABLE_NAME_MAIL = "mail";
public static String TABLE_NAME_NOTICE = "notice"; public static String TABLE_NAME_NOTICE = "notice";
public static String TABLE_NAME_BATTLE_EVENT = "battle_event"; public static String TABLE_NAME_BATTLE_EVENT = "battle_event";
public static String TABLE_NAME_MESSAGE = "message"; public static String TABLE_NAME_MESSAGE = "message";
public static String TABLE_NAME_DATA_INIT = "data_initialize_schedule";
} }

View File

@@ -58,6 +58,7 @@ public class ExcelUtils {
return value; return value;
} }
switch (cell.getCellType()) { switch (cell.getCellType()) {
case STRING: // getRichStringCellValue() 메소드를 사용하여 컨텐츠를 읽음 case STRING: // getRichStringCellValue() 메소드를 사용하여 컨텐츠를 읽음
value = cell.getRichStringCellValue().getString(); value = cell.getRichStringCellValue().getString();

View File

@@ -47,8 +47,11 @@ public class MongoBusinessLogConfig {
String auth = username.isEmpty() ? "" : String.format("%s:%s@",username, encodePassword); String auth = username.isEmpty() ? "" : String.format("%s:%s@",username, encodePassword);
String connection; String connection;
if(activeProfile.equals("local") || activeProfile.equals("dev")) { if(activeProfile.equals("local") || activeProfile.equals("dev")) {
// connection = String.format("mongodb+srv://%s%s/%s?retryWrites=true&w=majority", auth, businessLogHost, businessLogdb); if(businessLogHost.contains("metaverse")){
connection = String.format("mongodb+srv://%s%s/%s?retryWrites=true&w=majority", auth, businessLogHost, businessLogdb);
}else{
connection = String.format("mongodb://%s%s/?authSource=%s", auth, businessLogHost, businessLogdb); connection = String.format("mongodb://%s%s/?authSource=%s", auth, businessLogHost, businessLogdb);
}
}else{ }else{
connection = String.format("mongodb+srv://%s%s/%s?retryWrites=true&w=majority&appName=backoffice-%s", auth, businessLogHost, businessLogdb, activeProfile); connection = String.format("mongodb+srv://%s%s/%s?retryWrites=true&w=majority&appName=backoffice-%s", auth, businessLogHost, businessLogdb, activeProfile);
} }

View File

@@ -18,7 +18,7 @@ import java.nio.charset.StandardCharsets;
@Configuration @Configuration
@EnableMongoRepositories(basePackageClasses = MongoIndicatorRepository.class, basePackages = "com.caliverse.admin.history.repository", mongoTemplateRef = "mongoIndicatorTemplate") @EnableMongoRepositories(basePackageClasses = MongoIndicatorRepository.class, basePackages = "com.caliverse.admin.mongodb.repository", mongoTemplateRef = "mongoIndicatorTemplate")
public class MongoIndicatorConfig { public class MongoIndicatorConfig {
// @Value("${mongodb.indicator.uri}") // @Value("${mongodb.indicator.uri}")

View File

@@ -26,10 +26,14 @@ public class S3Config {
@Bean @Bean
@ConditionalOnProperty(name = "amazon.s3.enabled", havingValue = "true") @ConditionalOnProperty(name = "amazon.s3.enabled", havingValue = "true")
public S3Client s3Client() { public S3Client s3Client() {
if(!accessKey.isEmpty()) {
AwsBasicCredentials credentials = AwsBasicCredentials.create(accessKey, secretKey); AwsBasicCredentials credentials = AwsBasicCredentials.create(accessKey, secretKey);
return S3Client.builder() return S3Client.builder()
.credentialsProvider(StaticCredentialsProvider.create(credentials)) .credentialsProvider(StaticCredentialsProvider.create(credentials))
.region(Region.of(region)) .region(Region.of(region))
.build(); .build();
} }
return S3Client.builder()
.build();
}
} }

View File

@@ -1,5 +0,0 @@
package com.caliverse.admin.history.domain;
public interface historyLog {
}

View File

@@ -1,6 +0,0 @@
package com.caliverse.admin.history.repository;
public interface MongoAdminRepository {
}

View File

@@ -56,15 +56,20 @@ public class BusinessLogGenericService extends BusinessLogServiceBase {
List<LogGenericRequest.LogFilter> filters = logGenericRequest.getFilters(); List<LogGenericRequest.LogFilter> filters = logGenericRequest.getFilters();
Criteria criteria = makeCriteria(startTime, endTime); Criteria criteria = makeCriteria(startTime, endTime);
if(logAction != null && !logAction.equals(LogAction.None)) {
criteria.and(AdminConstants.MONGO_DB_KEY_MESSAGE)
.regex(String.format(AdminConstants.REGEX_MSG_ACTION, logAction.name()));
}
List<AggregationOperation> operations = setDefaultOperation(criteria); List<AggregationOperation> operations = setDefaultOperation(criteria);
if(logAction != null && !logAction.equals(LogAction.None)) { // if(logAction != null && !logAction.equals(LogAction.None)) {
operations.add(context -> // operations.add(context ->
new Document("$match", // new Document("$match",
new Document(AdminConstants.MONGO_DB_KEY_ACTION, logAction.name()) // new Document(AdminConstants.MONGO_DB_KEY_ACTION, logAction.name())
) // )
); // );
} // }
if(logDomain != null && !logDomain.equals(LogDomain.BASE)) { if(logDomain != null && !logDomain.equals(LogDomain.BASE)) {
operations.add(context -> operations.add(context ->

View File

@@ -1,4 +1,4 @@
package com.caliverse.admin.history; package com.caliverse.admin.mongodb;
import com.caliverse.admin.domain.adminlog.FieldChange; import com.caliverse.admin.domain.adminlog.FieldChange;
import com.caliverse.admin.dynamodb.domain.DocAttributeHandler; import com.caliverse.admin.dynamodb.domain.DocAttributeHandler;

View File

@@ -0,0 +1,16 @@
package com.caliverse.admin.mongodb.domain;
import com.caliverse.admin.global.common.utils.DateUtils;
import com.caliverse.admin.mongodb.entity.EActionType;
import lombok.Getter;
import lombok.Setter;
import org.springframework.data.mongodb.core.mapping.Document;
@Getter
@Setter
@Document(collection = "apiLog")
public class APILogInfo extends APILogInfoBase {
public APILogInfo(EActionType actionType, String tranId, Object body) {
super(DateUtils.nowDateTime(), actionType, tranId, body);
}
}

View File

@@ -0,0 +1,25 @@
package com.caliverse.admin.mongodb.domain;
import com.caliverse.admin.mongodb.entity.EActionType;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class APILogInfoBase implements apiLog {
private String timestamp;
private EActionType actionType;
private String tranId;
private Object body;
public APILogInfoBase(String timestamp,
EActionType actionType,
String tranId,
Object body
) {
this.timestamp = timestamp;
this.actionType = actionType;
this.tranId = tranId;
this.body = body;
}
}

View File

@@ -1,35 +1,29 @@
package com.caliverse.admin.history.domain; package com.caliverse.admin.mongodb.domain;
import com.caliverse.admin.domain.entity.EInitDataType; import com.caliverse.admin.domain.entity.EInitDataType;
import com.caliverse.admin.history.entity.DBType; import com.caliverse.admin.mongodb.entity.DBType;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
@Getter @Getter
@Setter @Setter
public class DataInitializeHistoryBase implements historyLog { public class DataInitializeHistoryBase {
private DBType dbType; private DBType dbType;
private String timestamp;
private EInitDataType initDataType; private EInitDataType initDataType;
private String tableName; private String tableName;
private String tranId;
private boolean isSuccess; private boolean isSuccess;
private String message; private String message;
public DataInitializeHistoryBase(DBType dbType, public DataInitializeHistoryBase(DBType dbType,
String timestamp,
EInitDataType initDataType, EInitDataType initDataType,
String tableName, String tableName,
String tranId,
boolean isSuccess, boolean isSuccess,
String message String message
) { ) {
this.dbType = dbType; this.dbType = dbType;
this.timestamp = timestamp;
this.initDataType = initDataType; this.initDataType = initDataType;
this.tableName = tableName; this.tableName = tableName;
this.tranId = tranId;
this.isSuccess = isSuccess; this.isSuccess = isSuccess;
this.message = message; this.message = message;
} }

View File

@@ -1,18 +1,15 @@
package com.caliverse.admin.history.domain; package com.caliverse.admin.mongodb.domain;
import com.caliverse.admin.domain.entity.EInitDataType; import com.caliverse.admin.domain.entity.EInitDataType;
import com.caliverse.admin.dynamodb.domain.doc.DynamoDBDocBase; import com.caliverse.admin.dynamodb.domain.doc.DynamoDBDocBase;
import com.caliverse.admin.global.common.utils.DateUtils; import com.caliverse.admin.mongodb.entity.DBType;
import com.caliverse.admin.history.entity.DBType;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import org.springframework.data.mongodb.core.mapping.Document; import org.springframework.data.mongodb.core.mapping.Document;
import java.util.List;
@Getter @Getter
@Setter @Setter
@Document(collection = "dataInitHistory") @Document(collection = "apiLog")
public class DynamodbDataInitializeHistory extends DataInitializeHistoryBase { public class DynamodbDataInitializeHistory extends DataInitializeHistoryBase {
private DynamoDBDocBase data; private DynamoDBDocBase data;
@@ -20,12 +17,11 @@ public class DynamodbDataInitializeHistory extends DataInitializeHistoryBase {
public DynamodbDataInitializeHistory(EInitDataType initDataType, public DynamodbDataInitializeHistory(EInitDataType initDataType,
String tableName, String tableName,
String tranId,
boolean isSuccess, boolean isSuccess,
String message, String message,
DynamoDBDocBase data, DynamoDBDocBase data,
String key) { String key) {
super(DBType.DYNAMODB, DateUtils.nowDateTime(), initDataType, tableName, tranId, isSuccess, message); super(DBType.DYNAMODB, initDataType, tableName, isSuccess, message);
this.data = data; this.data = data;
this.key = key; this.key = key;

View File

@@ -1,11 +1,11 @@
package com.caliverse.admin.history.domain; package com.caliverse.admin.mongodb.domain;
import com.caliverse.admin.domain.adminlog.FieldChange; import com.caliverse.admin.domain.adminlog.FieldChange;
import com.caliverse.admin.domain.entity.HISTORYTYPE; import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
import com.caliverse.admin.dynamodb.domain.doc.DynamoDBDocBase; import com.caliverse.admin.dynamodb.domain.doc.DynamoDBDocBase;
import com.caliverse.admin.global.common.utils.DateUtils; import com.caliverse.admin.global.common.utils.DateUtils;
import com.caliverse.admin.history.entity.DBType; import com.caliverse.admin.mongodb.entity.DBType;
import com.caliverse.admin.history.entity.EDBOperationType; import com.caliverse.admin.mongodb.entity.EDBOperationType;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import org.springframework.data.mongodb.core.mapping.Document; import org.springframework.data.mongodb.core.mapping.Document;
@@ -19,8 +19,8 @@ public class DynamodbHistoryLogInfo extends HistoryLogInfoBase {
private DynamoDBDocBase data; private DynamoDBDocBase data;
public DynamodbHistoryLogInfo(EDBOperationType operationType, HISTORYTYPE historytype, String tableName, String message, String tranId, List<FieldChange> changed, String userId, String userIP, DynamoDBDocBase data) { public DynamodbHistoryLogInfo(EDBOperationType operationType, HISTORYTYPEDETAIL historyType, String tableName, String message, String tranId, List<FieldChange> changed, String userId, String userIP, DynamoDBDocBase data) {
super(DBType.DYNAMODB, DateUtils.nowDateTime(), operationType, historytype, tableName, message, tranId,changed, userId, userIP); super(DBType.DYNAMODB, DateUtils.nowDateTime(), operationType, historyType, tableName, message, tranId, changed, userId, userIP);
this.data = data; this.data = data;
} }

View File

@@ -1,25 +1,27 @@
package com.caliverse.admin.history.domain; package com.caliverse.admin.mongodb.domain;
import com.caliverse.admin.domain.adminlog.FieldChange; import com.caliverse.admin.domain.adminlog.FieldChange;
import com.caliverse.admin.domain.entity.HISTORYTYPE; import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
import com.caliverse.admin.history.entity.DBType; import com.caliverse.admin.mongodb.entity.DBType;
import com.caliverse.admin.history.entity.EDBOperationType; import com.caliverse.admin.mongodb.entity.EDBOperationType;
import lombok.Getter; import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter; import lombok.Setter;
import java.util.List; import java.util.List;
@Getter @Getter
@Setter @Setter
@NoArgsConstructor
public class HistoryLogInfoBase implements historyLog { public class HistoryLogInfoBase implements historyLog {
private DBType dbType; private DBType dbType;
private String timestamp; private String timestamp;
private EDBOperationType operationType; private EDBOperationType operationType;
private HISTORYTYPE historyType; private HISTORYTYPEDETAIL historyType;
private String tableName; private String tableName;
private String message; private String message;
private String TranId; private String tranId;
private List<FieldChange> changed; private List<FieldChange> changed;
private String userId; private String userId;
private String userIP; private String userIP;
@@ -27,10 +29,10 @@ public class HistoryLogInfoBase implements historyLog {
public HistoryLogInfoBase(DBType dbType, public HistoryLogInfoBase(DBType dbType,
String timestamp, String timestamp,
EDBOperationType operationType, EDBOperationType operationType,
HISTORYTYPE historyType, HISTORYTYPEDETAIL historyType,
String tableName, String tableName,
String message, String message,
String TranId, String tranId,
List<FieldChange> changed, List<FieldChange> changed,
String userId, String userId,
String userIP String userIP
@@ -41,7 +43,7 @@ public class HistoryLogInfoBase implements historyLog {
this.historyType = historyType; this.historyType = historyType;
this.tableName = tableName; this.tableName = tableName;
this.message = message; this.message = message;
this.TranId = TranId; this.tranId = tranId;
this.changed = changed; this.changed = changed;
this.userId = userId; this.userId = userId;
this.userIP = userIP; this.userIP = userIP;

View File

@@ -1,26 +1,24 @@
package com.caliverse.admin.history.domain; package com.caliverse.admin.mongodb.domain;
import com.caliverse.admin.domain.entity.EInitDataType; import com.caliverse.admin.domain.entity.EInitDataType;
import com.caliverse.admin.global.common.utils.DateUtils; import com.caliverse.admin.mongodb.entity.DBType;
import com.caliverse.admin.history.entity.DBType;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import org.springframework.data.mongodb.core.mapping.Document; import org.springframework.data.mongodb.core.mapping.Document;
@Getter @Getter
@Setter @Setter
@Document(collection = "dataInitHistory") @Document(collection = "apiLog")
public class MysqlDataInitializeHistory extends DataInitializeHistoryBase { public class MysqlDataInitializeHistory extends DataInitializeHistoryBase {
private Object data; private Object data;
public MysqlDataInitializeHistory(EInitDataType initDataType, public MysqlDataInitializeHistory(EInitDataType initDataType,
String tableName, String tableName,
String TranId,
boolean isSuccess, boolean isSuccess,
String message, String message,
Object data) { Object data) {
super(DBType.MYSQL, DateUtils.nowDateTime(), initDataType, tableName, TranId, isSuccess, message); super(DBType.MYSQL, initDataType, tableName, isSuccess, message);
this.data = data; this.data = data;
} }

View File

@@ -1,16 +1,12 @@
package com.caliverse.admin.history.domain; package com.caliverse.admin.mongodb.domain;
import com.caliverse.admin.domain.adminlog.FieldChange; import com.caliverse.admin.domain.adminlog.FieldChange;
import com.caliverse.admin.domain.entity.HISTORYTYPE; import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
import com.caliverse.admin.global.common.utils.DateUtils; import com.caliverse.admin.global.common.utils.DateUtils;
import com.caliverse.admin.history.entity.DBType; import com.caliverse.admin.mongodb.entity.DBType;
import com.caliverse.admin.history.entity.EDBOperationType; import com.caliverse.admin.mongodb.entity.EDBOperationType;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.data.mongodb.core.mapping.Document; import org.springframework.data.mongodb.core.mapping.Document;
import java.util.List; import java.util.List;
@@ -22,8 +18,8 @@ public class MysqlHistoryLogInfo extends HistoryLogInfoBase {
private Object data; private Object data;
public MysqlHistoryLogInfo(EDBOperationType operationType, HISTORYTYPE historytype, String tableName, String message, String tranId, List<FieldChange> changed, String userId, String userIP, Object data) { public MysqlHistoryLogInfo(EDBOperationType operationType, HISTORYTYPEDETAIL historyType, String tableName, String message, String tranId, List<FieldChange> changed, String userId, String userIP, Object data) {
super(DBType.MYSQL, DateUtils.nowDateTime(), operationType, historytype, tableName, message, tranId, changed, userId, userIP); super(DBType.MYSQL, DateUtils.nowDateTime(), operationType, historyType, tableName, message, tranId, changed, userId, userIP);
this.data = data; this.data = data;
// this.data = deepCopy(data); // this.data = deepCopy(data);

View File

@@ -0,0 +1,5 @@
package com.caliverse.admin.mongodb.domain;
public interface apiLog {
}

View File

@@ -0,0 +1,5 @@
package com.caliverse.admin.mongodb.domain;
public interface historyLog {
}

View File

@@ -1,4 +1,4 @@
package com.caliverse.admin.history.entity; package com.caliverse.admin.mongodb.entity;
public enum DBType { public enum DBType {

View File

@@ -0,0 +1,14 @@
package com.caliverse.admin.mongodb.entity;
public enum EActionType {
SCHEDULE("스케줄"),
DATA_INIT("데이터 초기화"),
MAIL("우편"),
EVENT("이벤트");
private String actionType;
EActionType(String type) {
this.actionType = type;
}
}

View File

@@ -1,4 +1,4 @@
package com.caliverse.admin.history.entity; package com.caliverse.admin.mongodb.entity;
public enum EDBOperationType { public enum EDBOperationType {

View File

@@ -0,0 +1,8 @@
package com.caliverse.admin.mongodb.repository;
import com.caliverse.admin.mongodb.domain.APILogInfo;
import org.springframework.data.mongodb.repository.MongoRepository;
public interface APILogRepository extends MongoRepository<APILogInfo, String> {
}

View File

@@ -1,6 +1,6 @@
package com.caliverse.admin.history.repository; package com.caliverse.admin.mongodb.repository;
import com.caliverse.admin.history.domain.DynamodbDataInitializeHistory; import com.caliverse.admin.mongodb.domain.DynamodbDataInitializeHistory;
import org.springframework.data.mongodb.repository.MongoRepository; import org.springframework.data.mongodb.repository.MongoRepository;
public interface DynamodbDataInitializeHistoryRepository extends MongoRepository<DynamodbDataInitializeHistory, String> { public interface DynamodbDataInitializeHistoryRepository extends MongoRepository<DynamodbDataInitializeHistory, String> {

View File

@@ -1,6 +1,6 @@
package com.caliverse.admin.history.repository; package com.caliverse.admin.mongodb.repository;
import com.caliverse.admin.history.domain.DynamodbHistoryLogInfo; import com.caliverse.admin.mongodb.domain.DynamodbHistoryLogInfo;
import org.springframework.data.mongodb.repository.MongoRepository; import org.springframework.data.mongodb.repository.MongoRepository;
public interface DynamodbHistoryLogRepository extends MongoRepository<DynamodbHistoryLogInfo, String> { public interface DynamodbHistoryLogRepository extends MongoRepository<DynamodbHistoryLogInfo, String> {

View File

@@ -0,0 +1,6 @@
package com.caliverse.admin.mongodb.repository;
public interface MongoAdminRepository {
}

View File

@@ -1,6 +1,6 @@
package com.caliverse.admin.history.repository; package com.caliverse.admin.mongodb.repository;
import com.caliverse.admin.history.domain.MysqlDataInitializeHistory; import com.caliverse.admin.mongodb.domain.MysqlDataInitializeHistory;
import org.springframework.data.mongodb.repository.MongoRepository; import org.springframework.data.mongodb.repository.MongoRepository;
public interface MysqlDataInitializeHistoryRepository extends MongoRepository<MysqlDataInitializeHistory, String> { public interface MysqlDataInitializeHistoryRepository extends MongoRepository<MysqlDataInitializeHistory, String> {

View File

@@ -1,6 +1,6 @@
package com.caliverse.admin.history.repository; package com.caliverse.admin.mongodb.repository;
import com.caliverse.admin.history.domain.MysqlHistoryLogInfo; import com.caliverse.admin.mongodb.domain.MysqlHistoryLogInfo;
import org.springframework.data.mongodb.repository.MongoRepository; import org.springframework.data.mongodb.repository.MongoRepository;
public interface MysqlHistoryLogRepository extends MongoRepository<MysqlHistoryLogInfo, String> { public interface MysqlHistoryLogRepository extends MongoRepository<MysqlHistoryLogInfo, String> {

View File

@@ -1,13 +1,17 @@
package com.caliverse.admin.history.service; package com.caliverse.admin.mongodb.service;
import com.caliverse.admin.domain.entity.EInitDataType; import com.caliverse.admin.domain.entity.EInitDataType;
import com.caliverse.admin.domain.request.LogGenericRequest; import com.caliverse.admin.domain.request.LogGenericRequest;
import com.caliverse.admin.dynamodb.domain.doc.DynamoDBDocBase; import com.caliverse.admin.dynamodb.domain.doc.DynamoDBDocBase;
import com.caliverse.admin.global.common.constants.AdminConstants; import com.caliverse.admin.global.common.constants.AdminConstants;
import com.caliverse.admin.history.domain.DynamodbDataInitializeHistory; import com.caliverse.admin.global.component.transaction.TransactionIdManager;
import com.caliverse.admin.history.domain.MysqlDataInitializeHistory; import com.caliverse.admin.mongodb.domain.APILogInfo;
import com.caliverse.admin.history.repository.DynamodbDataInitializeHistoryRepository; import com.caliverse.admin.mongodb.domain.DynamodbDataInitializeHistory;
import com.caliverse.admin.history.repository.MysqlDataInitializeHistoryRepository; import com.caliverse.admin.mongodb.domain.MysqlDataInitializeHistory;
import com.caliverse.admin.mongodb.entity.EActionType;
import com.caliverse.admin.mongodb.repository.APILogRepository;
import com.caliverse.admin.mongodb.repository.DynamodbDataInitializeHistoryRepository;
import com.caliverse.admin.mongodb.repository.MysqlDataInitializeHistoryRepository;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@@ -32,7 +36,9 @@ public class DataInitializeHistoryService {
private final MysqlDataInitializeHistoryRepository mysqlDataInitializeHistoryRepository; private final MysqlDataInitializeHistoryRepository mysqlDataInitializeHistoryRepository;
private final DynamodbDataInitializeHistoryRepository dynamodbDataInitializeHistoryRepository; private final DynamodbDataInitializeHistoryRepository dynamodbDataInitializeHistoryRepository;
private final APILogRepository apiLogRepository;
private final ObjectMapper objectMapper; private final ObjectMapper objectMapper;
private final TransactionIdManager transactionIdManager;
@Autowired @Autowired
@Qualifier("mongoIndicatorTemplate") @Qualifier("mongoIndicatorTemplate")
@@ -69,7 +75,7 @@ public class DataInitializeHistoryService {
Aggregation aggregation = Aggregation.newAggregation(operations); Aggregation aggregation = Aggregation.newAggregation(operations);
log.info("loadHistoryData Query: {}", aggregation); log.info("loadHistoryData Query: {}", aggregation);
AggregationResults<T> results = mongoTemplate.aggregate(aggregation, AdminConstants.MONGO_DB_COLLECTION_DATA_INIT_HISTORY, class1); AggregationResults<T> results = mongoTemplate.aggregate(aggregation, AdminConstants.MONGO_DB_COLLECTION_API_LOG, class1);
return results.getMappedResults(); return results.getMappedResults();
} }
@@ -77,13 +83,12 @@ public class DataInitializeHistoryService {
return new Criteria() return new Criteria()
.andOperator( .andOperator(
Criteria.where(AdminConstants.MONGO_DB_KEY_TIMESTAMP).gte(startTime).lt(endTime) Criteria.where(AdminConstants.MONGO_DB_KEY_TIMESTAMP).gte(startTime).lt(endTime)
,Criteria.where(AdminConstants.MONGO_DB_KEY_DB_TYPE).is("DYNAMODB") ,Criteria.where(String.format("%s.%s",AdminConstants.MONGO_DB_KEY_BODY, AdminConstants.MONGO_DB_KEY_DB_TYPE)).is("DYNAMODB")
); );
} }
public <T> void mysqlDataInitHistory(EInitDataType dataType, public <T> void mysqlDataInitHistory(EInitDataType dataType,
String tableName, String tableName,
String tranId,
boolean isSuccess, boolean isSuccess,
String message, String message,
T data T data
@@ -93,13 +98,18 @@ public class DataInitializeHistoryService {
MysqlDataInitializeHistory history = new MysqlDataInitializeHistory( MysqlDataInitializeHistory history = new MysqlDataInitializeHistory(
dataType, dataType,
tableName, tableName,
tranId,
isSuccess, isSuccess,
message, message,
data data
); );
APILogInfo info = new APILogInfo(
EActionType.DATA_INIT,
transactionIdManager.getCurrentTransactionId(),
history
);
mysqlDataInitializeHistoryRepository.save(history); apiLogRepository.save(info);
// mysqlDataInitializeHistoryRepository.save(history);
}catch(Exception e){ }catch(Exception e){
log.error("dataInit history Save Error", e); log.error("dataInit history Save Error", e);
@@ -107,7 +117,6 @@ public class DataInitializeHistoryService {
} }
public <T> void dynamodbDataInitHistory(EInitDataType dataType, public <T> void dynamodbDataInitHistory(EInitDataType dataType,
String tranId,
boolean isSuccess, boolean isSuccess,
String message, String message,
DynamoDBDocBase data, DynamoDBDocBase data,
@@ -118,14 +127,19 @@ public class DataInitializeHistoryService {
DynamodbDataInitializeHistory history = new DynamodbDataInitializeHistory( DynamodbDataInitializeHistory history = new DynamodbDataInitializeHistory(
dataType, dataType,
dynamodbTableName, dynamodbTableName,
tranId,
isSuccess, isSuccess,
message, message,
data, data,
objectMapper.writeValueAsString(key) objectMapper.writeValueAsString(key)
); );
dynamodbDataInitializeHistoryRepository.save(history); APILogInfo info = new APILogInfo(
EActionType.DATA_INIT,
transactionIdManager.getCurrentTransactionId(),
history
);
// dynamodbDataInitializeHistoryRepository.save(history);
apiLogRepository.save(info);
}catch(Exception e){ }catch(Exception e){
log.error("dataInit history Save Error", e); log.error("dataInit history Save Error", e);

View File

@@ -1,14 +1,15 @@
package com.caliverse.admin.history.service; package com.caliverse.admin.mongodb.service;
import com.caliverse.admin.domain.adminlog.FieldChange; import com.caliverse.admin.domain.adminlog.FieldChange;
import com.caliverse.admin.domain.entity.HISTORYTYPE; import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
import com.caliverse.admin.dynamodb.domain.doc.DynamoDBDocBase; import com.caliverse.admin.dynamodb.domain.doc.DynamoDBDocBase;
import com.caliverse.admin.global.common.constants.CommonConstants;
import com.caliverse.admin.global.common.utils.CommonUtils; import com.caliverse.admin.global.common.utils.CommonUtils;
import com.caliverse.admin.global.component.transaction.TransactionIdManager; import com.caliverse.admin.global.component.transaction.TransactionIdManager;
import com.caliverse.admin.history.ChangeDetector; import com.caliverse.admin.mongodb.ChangeDetector;
import com.caliverse.admin.history.domain.DynamodbHistoryLogInfo; import com.caliverse.admin.mongodb.domain.DynamodbHistoryLogInfo;
import com.caliverse.admin.history.entity.EDBOperationType; import com.caliverse.admin.mongodb.entity.EDBOperationType;
import com.caliverse.admin.history.repository.DynamodbHistoryLogRepository; import com.caliverse.admin.mongodb.repository.DynamodbHistoryLogRepository;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -25,7 +26,7 @@ public class DynamodbHistoryLogService {
private final TransactionIdManager transactionIdManager; private final TransactionIdManager transactionIdManager;
private final DynamodbHistoryLogRepository dynamodbHistoryLogRepository; private final DynamodbHistoryLogRepository dynamodbHistoryLogRepository;
public void insertHistoryLog(HISTORYTYPE historyType, public void insertHistoryLog(HISTORYTYPEDETAIL historyType,
String message, String message,
DynamoDBDocBase metadata DynamoDBDocBase metadata
){ ){
@@ -40,8 +41,8 @@ public class DynamodbHistoryLogService {
message, message,
transactionIdManager.getCurrentTransactionId(), transactionIdManager.getCurrentTransactionId(),
changes, changes,
CommonUtils.getAdmin() == null ? "" : CommonUtils.getAdmin().getEmail(), CommonUtils.getAdmin() == null ? CommonConstants.SYSTEM : CommonUtils.getAdmin().getEmail(),
CommonUtils.getClientIp() == null ? "" : CommonUtils.getClientIp(), CommonUtils.getClientIp() == null ? CommonConstants.SYSTEM : CommonUtils.getClientIp(),
metadata metadata
); );
@@ -49,7 +50,7 @@ public class DynamodbHistoryLogService {
} }
} }
public void updateHistoryLog(HISTORYTYPE historyType, public void updateHistoryLog(HISTORYTYPEDETAIL historyType,
String message, String message,
DynamoDBDocBase beforeMetadata, DynamoDBDocBase beforeMetadata,
DynamoDBDocBase afterMetadata DynamoDBDocBase afterMetadata
@@ -67,8 +68,8 @@ public class DynamodbHistoryLogService {
message, message,
transactionIdManager.getCurrentTransactionId(), transactionIdManager.getCurrentTransactionId(),
changes, changes,
CommonUtils.getAdmin() == null ? "" : CommonUtils.getAdmin().getEmail(), CommonUtils.getAdmin() == null ? CommonConstants.SYSTEM : CommonUtils.getAdmin().getEmail(),
CommonUtils.getClientIp() == null ? "" : CommonUtils.getClientIp(), CommonUtils.getClientIp() == null ? CommonConstants.SYSTEM : CommonUtils.getClientIp(),
afterMetadata afterMetadata
); );
@@ -76,7 +77,7 @@ public class DynamodbHistoryLogService {
} }
} }
public void deleteHistoryLog(HISTORYTYPE historyType, public void deleteHistoryLog(HISTORYTYPEDETAIL historyType,
String message, String message,
DynamoDBDocBase metadata DynamoDBDocBase metadata
){ ){
@@ -91,8 +92,8 @@ public class DynamodbHistoryLogService {
message, message,
transactionIdManager.getCurrentTransactionId(), transactionIdManager.getCurrentTransactionId(),
changes, changes,
CommonUtils.getAdmin() == null ? "" : CommonUtils.getAdmin().getEmail(), CommonUtils.getAdmin() == null ? CommonConstants.SYSTEM : CommonUtils.getAdmin().getEmail(),
CommonUtils.getClientIp() == null ? "" : CommonUtils.getClientIp(), CommonUtils.getClientIp() == null ? CommonConstants.SYSTEM : CommonUtils.getClientIp(),
metadata metadata
); );

View File

@@ -0,0 +1,100 @@
package com.caliverse.admin.mongodb.service;
import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
import com.caliverse.admin.domain.request.HistoryRequest;
import com.caliverse.admin.global.common.constants.AdminConstants;
import com.caliverse.admin.mongodb.entity.DBType;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.bson.Document;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.aggregation.Aggregation;
import org.springframework.data.mongodb.core.aggregation.AggregationOperation;
import org.springframework.data.mongodb.core.aggregation.AggregationResults;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@RequiredArgsConstructor
@Service
@Slf4j
public class HistoryLogService {
@Autowired
@Qualifier("mongoIndicatorTemplate")
private MongoTemplate mongoTemplate;
public <T> List<T> loadHistoryData(HistoryRequest historyRequest, Class<T> class1) {
String startTime = historyRequest.getStartDt() != null ? historyRequest.getStartDt().toString() : "";
String endTime = historyRequest.getEndDt() != null ? historyRequest.getEndDt().toString() : "";
HISTORYTYPEDETAIL historyType = historyRequest.getHistoryType() != null ? historyRequest.getHistoryType() : null;
String user = historyRequest.getUserMail() != null ? historyRequest.getUserMail() : "";
DBType dbType = historyRequest.getDbType() != null ? historyRequest.getDbType() : null;
List<AggregationOperation> operations = new ArrayList<>();
Criteria criteria = null;
if(!startTime.isEmpty() && !endTime.isEmpty()) {
criteria = makeCriteria(startTime, endTime);
operations.add(Aggregation.match(criteria));
}
if(historyType != null) {
operations.add(context ->
new Document("$match",
new Document(AdminConstants.MONGO_DB_KEY_HISTORY_TYPE, historyType)
)
);
}
if(!user.isEmpty()) {
operations.add(context ->
new Document("$match",
new Document(AdminConstants.MONGO_DB_KEY_USER_ID, user)
)
);
}
if(dbType != null){
operations.add(context ->
new Document("$match",
new Document(AdminConstants.MONGO_DB_KEY_DB_TYPE, dbType)
)
);
}
if(historyRequest.getTableName() != null && !historyRequest.getTableName().isEmpty()){
operations.add(context ->
new Document("$match",
new Document()
.append(AdminConstants.MONGO_DB_KEY_TABLE_NAME, historyRequest.getTableName())
.append("data._id", historyRequest.getSqlId())
)
);
}
// 최종 출력 형식
operations.add(context ->
new Document("$sort",
new Document(AdminConstants.MONGO_DB_KEY_TIMESTAMP, -1)
)
);
Aggregation aggregation = Aggregation.newAggregation(operations);
log.info("loadHistoryData Query: {}", aggregation);
AggregationResults<T> results = mongoTemplate.aggregate(aggregation, AdminConstants.MONGO_DB_COLLECTION_HISTORY_LOG, class1);
return results.getMappedResults();
}
protected Criteria makeCriteria(String startTime, String endTime) {
return new Criteria()
.andOperator(
Criteria.where(AdminConstants.MONGO_DB_KEY_TIMESTAMP).gte(startTime).lt(endTime)
);
}
}

View File

@@ -1,15 +1,17 @@
package com.caliverse.admin.history.service; package com.caliverse.admin.mongodb.service;
import com.caliverse.admin.domain.adminlog.FieldChange; import com.caliverse.admin.domain.adminlog.FieldChange;
import com.caliverse.admin.domain.entity.HISTORYTYPE; import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
import com.caliverse.admin.global.common.code.CommonCode; import com.caliverse.admin.global.common.code.CommonCode;
import com.caliverse.admin.global.common.code.ErrorCode; import com.caliverse.admin.global.common.code.ErrorCode;
import com.caliverse.admin.global.common.constants.CommonConstants;
import com.caliverse.admin.global.common.exception.RestApiException; import com.caliverse.admin.global.common.exception.RestApiException;
import com.caliverse.admin.global.common.utils.CommonUtils;
import com.caliverse.admin.global.component.transaction.TransactionIdManager; import com.caliverse.admin.global.component.transaction.TransactionIdManager;
import com.caliverse.admin.history.ChangeDetector; import com.caliverse.admin.mongodb.ChangeDetector;
import com.caliverse.admin.history.domain.MysqlHistoryLogInfo; import com.caliverse.admin.mongodb.domain.MysqlHistoryLogInfo;
import com.caliverse.admin.history.entity.EDBOperationType; import com.caliverse.admin.mongodb.entity.EDBOperationType;
import com.caliverse.admin.history.repository.MysqlHistoryLogRepository; import com.caliverse.admin.mongodb.repository.MysqlHistoryLogRepository;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@@ -26,12 +28,10 @@ public class MysqlHistoryLogService {
private final MysqlHistoryLogRepository mysqlHistoryLogRepository; private final MysqlHistoryLogRepository mysqlHistoryLogRepository;
private final ObjectMapper objectMapper; private final ObjectMapper objectMapper;
public <T> void insertHistoryLog(HISTORYTYPE historyType, public <T> void insertHistoryLog(HISTORYTYPEDETAIL historyType,
String tableName, String tableName,
String message, String message,
T data, T data
String userId,
String userIP
){ ){
try { try {
List<FieldChange> changes = ChangeDetector.detectInsertChanges(data); List<FieldChange> changes = ChangeDetector.detectInsertChanges(data);
@@ -44,8 +44,8 @@ public class MysqlHistoryLogService {
message, message,
transactionIdManager.getCurrentTransactionId(), transactionIdManager.getCurrentTransactionId(),
changes, changes,
userId, CommonUtils.getAdmin() == null ? CommonConstants.SYSTEM : CommonUtils.getAdmin().getEmail(),
userIP, CommonUtils.getClientIp() == null ? CommonConstants.SYSTEM : CommonUtils.getClientIp(),
data data
); );
@@ -57,13 +57,11 @@ public class MysqlHistoryLogService {
} }
} }
public <T> void updateHistoryLog(HISTORYTYPE historyType, public <T> void updateHistoryLog(HISTORYTYPEDETAIL historyType,
String tableName, String tableName,
String message, String message,
T beforeData, T beforeData,
T afterData, T afterData
String userId,
String userIP
){ ){
try { try {
List<FieldChange> changes = ChangeDetector.detectChanges( List<FieldChange> changes = ChangeDetector.detectChanges(
@@ -78,8 +76,8 @@ public class MysqlHistoryLogService {
message, message,
transactionIdManager.getCurrentTransactionId(), transactionIdManager.getCurrentTransactionId(),
changes, changes,
userId, CommonUtils.getAdmin() == null ? CommonConstants.SYSTEM : CommonUtils.getAdmin().getEmail(),
userIP, CommonUtils.getClientIp() == null ? CommonConstants.SYSTEM : CommonUtils.getClientIp(),
afterData afterData
); );
@@ -91,12 +89,10 @@ public class MysqlHistoryLogService {
} }
} }
public <T> void deleteHistoryLog(HISTORYTYPE historyType, public <T> void deleteHistoryLog(HISTORYTYPEDETAIL historyType,
String tableName, String tableName,
String message, String message,
T data, T data
String userId,
String userIP
){ ){
// List<FieldChange> changes = ChangeDetector.detectDeleteChanges(data); // List<FieldChange> changes = ChangeDetector.detectDeleteChanges(data);
@@ -115,8 +111,8 @@ public class MysqlHistoryLogService {
message, message,
transactionIdManager.getCurrentTransactionId(), transactionIdManager.getCurrentTransactionId(),
changes, changes,
userId, CommonUtils.getAdmin() == null ? CommonConstants.SYSTEM : CommonUtils.getAdmin().getEmail(),
userIP, CommonUtils.getClientIp() == null ? CommonConstants.SYSTEM : CommonUtils.getClientIp(),
data data
); );

View File

@@ -1,4 +1,4 @@
package com.caliverse.admin.history.service; package com.caliverse.admin.mongodb.service;
import com.caliverse.admin.global.common.constants.AdminConstants; import com.caliverse.admin.global.common.constants.AdminConstants;
import com.caliverse.admin.logs.logservice.businesslogservice.IBusinessLogService; import com.caliverse.admin.logs.logservice.businesslogservice.IBusinessLogService;

View File

@@ -11,15 +11,11 @@ import com.caliverse.admin.dynamodb.domain.atrrib.LandAuctionHighestBidUserAttri
import com.caliverse.admin.dynamodb.domain.atrrib.LandAuctionRegistryAttrib; import com.caliverse.admin.dynamodb.domain.atrrib.LandAuctionRegistryAttrib;
import com.caliverse.admin.domain.entity.redis.RedisLoginInfo; import com.caliverse.admin.domain.entity.redis.RedisLoginInfo;
import com.caliverse.admin.domain.service.*; import com.caliverse.admin.domain.service.*;
import com.caliverse.admin.dynamodb.entity.SystemMessage;
import com.caliverse.admin.dynamodb.service.DynamodbService; import com.caliverse.admin.dynamodb.service.DynamodbService;
import com.caliverse.admin.global.common.utils.CommonUtils; import com.caliverse.admin.global.common.utils.CommonUtils;
import com.caliverse.admin.global.common.utils.ExcelUtils; import com.caliverse.admin.global.common.utils.ExcelUtils;
import com.caliverse.admin.global.common.utils.JsonUtils;
import com.caliverse.admin.redis.service.RedisUserInfoService; import com.caliverse.admin.redis.service.RedisUserInfoService;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
import lombok.*; import lombok.*;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -34,10 +30,6 @@ import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture; import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.function.Function;
import java.util.stream.Collectors;
import static com.caliverse.admin.global.common.utils.DynamodbUtil.getLanguageType;
@Service @Service
@AllArgsConstructor @AllArgsConstructor
@@ -338,7 +330,7 @@ public class DynamicScheduler {
}); });
}catch (Exception e){ }catch (Exception e){
log.error("mailSchedule Exception: {}", e.getMessage()); log.error("mailSchedule Exception: {}", e.getMessage());
mailService.setScheduleLog(HISTORYTYPE.SCHEDULE_MAIL_FAIL, e.getMessage()); mailService.setScheduleLog(HISTORYTYPEDETAIL.SCHEDULE_MAIL_FAIL, e.getMessage());
} }
} }
@@ -461,7 +453,7 @@ public class DynamicScheduler {
if(initialDelay < 0) { if(initialDelay < 0) {
log.error("noticeJob noticeSchedule schedule add fail time over"); log.error("noticeJob noticeSchedule schedule add fail time over");
noticeService.updateNoticeStatus(notice.getId(), InGame.SENDSTATUS.FAIL); noticeService.updateNoticeStatus(notice.getId(), InGame.SENDSTATUS.FAIL);
mailService.setScheduleLog(HISTORYTYPE.SCHEDULE_NOTICE_FAIL, "시작일자가 현재일자보다 이전으로 송출 중단."); mailService.setScheduleLog(HISTORYTYPEDETAIL.SCHEDULE_NOTICE_FAIL, "시작일자가 현재일자보다 이전으로 송출 중단.");
return; return;
} }
@@ -473,7 +465,7 @@ public class DynamicScheduler {
}); });
}catch (Exception e){ }catch (Exception e){
log.error("noticeSchedule Exception: {}", e.getMessage()); log.error("noticeSchedule Exception: {}", e.getMessage());
noticeService.setScheduleLog(HISTORYTYPE.SCHEDULE_NOTICE_FAIL, e.getMessage()); noticeService.setScheduleLog(HISTORYTYPEDETAIL.SCHEDULE_NOTICE_FAIL, e.getMessage());
} }
} }
@@ -493,7 +485,7 @@ public class DynamicScheduler {
is_send = mainSend(mail); is_send = mainSend(mail);
if(!is_send){ if(!is_send){
log.error("mailJob mailSchedule Excel fail user : {}", excel.getUser()); log.error("mailJob mailSchedule Excel fail user : {}", excel.getUser());
mailService.setScheduleLog(HISTORYTYPE.SCHEDULE_MAIL_FAIL, "mail schedule id: " + mail.getId() + " Excel Send Fail User: " + excel.getUser()); mailService.setScheduleLog(HISTORYTYPEDETAIL.SCHEDULE_MAIL_FAIL, "mail schedule id: " + mail.getId() + " Excel Send Fail User: " + excel.getUser());
} }
else log.info("mailJob mailSchedule Excel send user : {}", excel.getUser()); else log.info("mailJob mailSchedule Excel send user : {}", excel.getUser());
} }
@@ -512,7 +504,7 @@ public class DynamicScheduler {
if(server_name == null){ if(server_name == null){
log.error("mailJob mainSend serverName is empty"); log.error("mailJob mainSend serverName is empty");
mailService.updateMailStatus(mail.getId(), Mail.SENDSTATUS.FAIL); mailService.updateMailStatus(mail.getId(), Mail.SENDSTATUS.FAIL);
mailService.setScheduleLog(HISTORYTYPE.MAIL_SEND_FAIL, "is null server name"); mailService.setScheduleLog(HISTORYTYPEDETAIL.MAIL_SEND_FAIL, "is null server name");
return false; return false;
} }
}else{ }else{
@@ -566,7 +558,7 @@ public class DynamicScheduler {
}catch(Exception e){ }catch(Exception e){
log.error("mailSend Exception: {}", e.getMessage()); log.error("mailSend Exception: {}", e.getMessage());
mailService.updateMailStatus(mail.getId(), Mail.SENDSTATUS.FAIL); mailService.updateMailStatus(mail.getId(), Mail.SENDSTATUS.FAIL);
mailService.setScheduleLog(HISTORYTYPE.MAIL_SEND_FAIL, e.getMessage()); mailService.setScheduleLog(HISTORYTYPEDETAIL.MAIL_SEND_FAIL, e.getMessage());
} }
return false; return false;
} }
@@ -579,7 +571,7 @@ public class DynamicScheduler {
if(serverList.isEmpty()){ if(serverList.isEmpty()){
log.error("noticeJob noticeSend serverList is empty"); log.error("noticeJob noticeSend serverList is empty");
noticeService.updateNoticeStatus(notice.getId(), InGame.SENDSTATUS.FAIL); noticeService.updateNoticeStatus(notice.getId(), InGame.SENDSTATUS.FAIL);
noticeService.setScheduleLog(HISTORYTYPE.NOTICE_SEND_FAIL, "is null server name"); noticeService.setScheduleLog(HISTORYTYPEDETAIL.NOTICE_SEND_FAIL, "is null server name");
return false; return false;
} }
@@ -617,7 +609,7 @@ public class DynamicScheduler {
}catch (Exception e){ }catch (Exception e){
log.error("noticeSend Exception: {}", e.getMessage()); log.error("noticeSend Exception: {}", e.getMessage());
noticeService.updateNoticeStatus(notice.getId(), InGame.SENDSTATUS.FAIL); noticeService.updateNoticeStatus(notice.getId(), InGame.SENDSTATUS.FAIL);
noticeService.setScheduleLog(HISTORYTYPE.NOTICE_SEND_FAIL, e.getMessage()); noticeService.setScheduleLog(HISTORYTYPEDETAIL.NOTICE_SEND_FAIL, e.getMessage());
} }
return false; return false;
} }

Some files were not shown because too many files have changed in this diff Show More