Compare commits
7 Commits
0cd0853a63
...
e8e49640de
| Author | SHA1 | Date | |
|---|---|---|---|
| e8e49640de | |||
| 3ca0ea4bb5 | |||
| ed072b94c0 | |||
| f537b6d424 | |||
| fe6eb55766 | |||
| 09daf27d72 | |||
| b38eb0c5b1 |
@@ -1,13 +1,11 @@
|
||||
package com.caliverse.admin.domain.adminlog;
|
||||
|
||||
import com.caliverse.admin.domain.entity.HISTORYTYPE;
|
||||
import org.json.JSONObject;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
|
||||
|
||||
public class AdminItemDeleteLog extends AdminLogBase {
|
||||
|
||||
public AdminItemDeleteLog(String userGuid, String itemGuid, String itemCount){
|
||||
super(HISTORYTYPE.USER_ITEM_DELETE);
|
||||
super(HISTORYTYPEDETAIL.USER_ITEM_DELETE);
|
||||
|
||||
var jsonObject = getJsonContentObject();
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.caliverse.admin.domain.adminlog;
|
||||
|
||||
|
||||
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.component.AdminApplicationContextProvider;
|
||||
import lombok.Getter;
|
||||
@@ -21,7 +21,7 @@ public abstract class AdminLogBase implements IAdminLog{
|
||||
private final HistoryMapper historyMapper;
|
||||
private static ApplicationContext context;
|
||||
|
||||
private final HISTORYTYPE historyType;
|
||||
private final HISTORYTYPEDETAIL historyType;
|
||||
|
||||
protected Map<String, Object> map;
|
||||
|
||||
@@ -29,7 +29,7 @@ public abstract class AdminLogBase implements IAdminLog{
|
||||
protected JSONObject jsonContentObject = new JSONObject();
|
||||
|
||||
|
||||
public AdminLogBase(HISTORYTYPE historyType) {
|
||||
public AdminLogBase(HISTORYTYPEDETAIL historyType) {
|
||||
|
||||
this.historyMapper = AdminApplicationContextProvider.getContext().getBean(HistoryMapper.class);
|
||||
this.historyType = historyType;
|
||||
@@ -49,7 +49,7 @@ public abstract class AdminLogBase implements IAdminLog{
|
||||
Long adminId = 0L;
|
||||
String adminName = "";
|
||||
String adminMail = "";
|
||||
HISTORYTYPE type = HISTORYTYPE.NONE;
|
||||
HISTORYTYPEDETAIL type = HISTORYTYPEDETAIL.NONE;
|
||||
try {
|
||||
adminId = CommonUtils.getAdmin().getId();
|
||||
adminName = CommonUtils.getAdmin().getName();
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
package com.caliverse.admin.domain.adminlog;
|
||||
|
||||
import com.caliverse.admin.domain.entity.AdminLog;
|
||||
import com.caliverse.admin.domain.entity.HISTORYTYPE;
|
||||
import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
|
||||
|
||||
public class AdminLoginPermitLog extends AdminLogBase {
|
||||
|
||||
public AdminLoginPermitLog() {
|
||||
super(HISTORYTYPE.LOGIN_PERMITTED);
|
||||
super(HISTORYTYPEDETAIL.LOGIN_PERMITTED);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
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 AdminPasswordInitLog(String name, String email) {
|
||||
super(HISTORYTYPE.PASSWORD_INIT);
|
||||
super(HISTORYTYPEDETAIL.PASSWORD_INIT);
|
||||
|
||||
var jsonObject = getJsonContentObject();
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.caliverse.admin.domain.api;
|
||||
|
||||
import com.caliverse.admin.domain.request.AuthenticateRequest;
|
||||
import com.caliverse.admin.domain.request.DataRequest;
|
||||
import com.caliverse.admin.domain.request.LogGenericRequest;
|
||||
import com.caliverse.admin.domain.response.DataResponse;
|
||||
import com.caliverse.admin.domain.response.LogResponse;
|
||||
@@ -41,13 +42,13 @@ public class DataController {
|
||||
|
||||
//데이터 초기화
|
||||
@PostMapping("/init-data")
|
||||
public ResponseEntity<DataResponse> initData(@RequestBody AuthenticateRequest authenticateRequest){
|
||||
public ResponseEntity<DataResponse> initData(@RequestBody DataRequest dataRequest){
|
||||
if(activeProfile.equals("live")){
|
||||
return ResponseEntity.status(HttpStatus.NOT_FOUND).body(DataResponse.builder()
|
||||
.status(CommonCode.ERROR.getHttpStatus())
|
||||
.result(ErrorCode.NOT_FOUNT_API.toString())
|
||||
.build());
|
||||
}
|
||||
return ResponseEntity.ok().body(dataService.initData(authenticateRequest));
|
||||
return ResponseEntity.ok().body(dataService.initData(dataRequest));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
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.service.HistoryService;
|
||||
|
||||
@@ -29,4 +30,9 @@ public class HistoryController {
|
||||
@PathVariable("id") String 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));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.caliverse.admin.domain.dao.admin;
|
||||
|
||||
import com.caliverse.admin.domain.entity.*;
|
||||
import com.caliverse.admin.domain.request.DataRequest;
|
||||
import com.caliverse.admin.domain.request.LandRequest;
|
||||
import org.apache.ibatis.annotations.*;
|
||||
|
||||
@@ -20,9 +21,21 @@ public interface DataMapper {
|
||||
})
|
||||
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}")
|
||||
int updateStatus(@Param("id") long id, @Param("status") String status);
|
||||
|
||||
@Insert("INSERT INTO data_initialize_schedule (data_type, create_by) VALUES (#{dataType}, #{createBy})")
|
||||
int postDataInit(@Param("dataType") EInitDataType dataType, @Param("createBy") long createBy);
|
||||
@Insert("INSERT INTO data_initialize_schedule (data_type, create_by) VALUES (#{request.initDataType}, #{request.createBy})")
|
||||
@Options(useGeneratedKeys = true, keyProperty = "request.id", keyColumn = "id")
|
||||
int postDataInit(@Param("request") DataRequest request);
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ public class BlackList {
|
||||
private LocalDateTime startDt;
|
||||
@JsonProperty("end_dt")
|
||||
private LocalDateTime endDt;
|
||||
private String reason;
|
||||
|
||||
//등록자 이메일 주소
|
||||
@JsonProperty("create_by")
|
||||
@@ -49,7 +50,8 @@ public class BlackList {
|
||||
WAIT,
|
||||
EXPIRATION, // 제재 종료
|
||||
INPROGRESS, // 제재 중
|
||||
FAIL
|
||||
FAIL,
|
||||
CANCEL
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,60 +4,28 @@ public enum HISTORYTYPE {
|
||||
|
||||
NONE("기본"),
|
||||
LOGIN_PERMITTED("로그인 승인"),
|
||||
ADMIN_INFO_UPDATE("운영자 정보 수정"),
|
||||
ADMIN_INFO_DELETE("운영자 정보 삭제"),
|
||||
ADMIN_INFO("운영자 정보"),
|
||||
PASSWORD_INIT("비밀번호 초기화"),
|
||||
USER_INFO_UPDATE("유저 정보 변경"),
|
||||
GROUP_AUTH_UPDATE("그룹 권한 수정"),
|
||||
USER_INFO("유저 정보"),
|
||||
GROUP_AUTH("그룹 권한"),
|
||||
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("우편 아이템 수정"),
|
||||
WHITELIST_DELETE("화이트리스트 삭제"),
|
||||
BLACKLIST_UPDATE("유저 제재 수정"),
|
||||
BLACKLIST_DELETE("유저 제재 삭제"),
|
||||
NOTICE("공지사항"),
|
||||
MAIL("우편"),
|
||||
BLACKLIST("유저 제재"),
|
||||
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("유저 관리자 권한 수정")
|
||||
USER_ITEM("유저 아이템"),
|
||||
USER_MAIL("유저 메일"),
|
||||
EVENT("이벤트"),
|
||||
CALIUM("칼리움 요청"),
|
||||
LAND_AUCTION("랜드경매"),
|
||||
BATTLE_EVENT("전투시스템 이벤트"),
|
||||
LAND("랜드"),
|
||||
MENU_BANNER("메뉴 배너"),
|
||||
ITEM("아이템"),
|
||||
USER_ADMIN_AUTH_UPDATE("유저 관리자 권한 수정"),
|
||||
NICKNAME_REGISTRY("닉네임 레지스트리 삭제"),
|
||||
NICKNAME("닉네임"),
|
||||
DATA_INIT("데이터 초기화")
|
||||
;
|
||||
private String historyType;
|
||||
HISTORYTYPE(String type) {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,7 @@ public class Log {
|
||||
private String name;
|
||||
private String mail;
|
||||
@JsonProperty("history_type")
|
||||
private HISTORYTYPE historyType;
|
||||
private HISTORYTYPEDETAIL historyType;
|
||||
private String content;
|
||||
@JsonProperty("create_dt")
|
||||
private LocalDateTime createDt;
|
||||
|
||||
@@ -9,12 +9,10 @@ import lombok.*;
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class AuthenticateRequest {
|
||||
|
||||
private int id;
|
||||
private String name;
|
||||
private String email;
|
||||
private String password;
|
||||
@JsonProperty("new_password")
|
||||
private String newPassword;
|
||||
@JsonProperty("init_data_type")
|
||||
private EInitDataType initDataType;
|
||||
}
|
||||
|
||||
@@ -10,16 +10,14 @@ import lombok.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class BlackListRequest {
|
||||
@Setter
|
||||
private Long id;
|
||||
private String guid;
|
||||
@Setter
|
||||
private String nickname;
|
||||
@Setter
|
||||
private BlackList.STATUSTYPE status;
|
||||
|
||||
private SANCTIONSTYPE type;
|
||||
@@ -30,7 +28,6 @@ public class BlackListRequest {
|
||||
@JsonProperty("end_dt")
|
||||
private LocalDateTime endDt;
|
||||
|
||||
@Setter
|
||||
@JsonProperty("create_by")
|
||||
private Long createBy;
|
||||
|
||||
@@ -38,10 +35,4 @@ public class BlackListRequest {
|
||||
@JsonProperty("list")
|
||||
private List<BlackList> blackList;
|
||||
|
||||
public enum POSTTYPE{
|
||||
SINGLE,
|
||||
MULTIPLE
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -1,23 +1,34 @@
|
||||
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.mongodb.entity.DBType;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Getter
|
||||
@Data
|
||||
public class HistoryRequest {
|
||||
@JsonProperty("search_type")
|
||||
private SEARCHTYPE searchType;
|
||||
@JsonProperty("search_key")
|
||||
private String searchKey;
|
||||
@JsonProperty("history_type")
|
||||
private HISTORYTYPE historyType; // 사용 이력
|
||||
@JsonProperty("start_dt")
|
||||
private LocalDateTime startDt;
|
||||
@JsonProperty("end_dt")
|
||||
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;
|
||||
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ public class MailRequest {
|
||||
@JsonProperty("mail_guid")
|
||||
private String MailGuid;
|
||||
@JsonProperty("item_id")
|
||||
private Long itemId;
|
||||
private Integer itemId;
|
||||
@JsonProperty("parrent_count")
|
||||
private Double parrentCount;
|
||||
private Double count;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.caliverse.admin.domain.response;
|
||||
|
||||
import com.caliverse.admin.history.domain.DynamodbDataInitializeHistory;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -8,8 +7,6 @@ import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
|
||||
@@ -44,6 +44,7 @@ public class CaliumResponse {
|
||||
@JsonProperty("total_all")
|
||||
// private int totalAll;
|
||||
private double totalAll;
|
||||
private Integer failCount;
|
||||
@JsonProperty("page_no")
|
||||
private int pageNo;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
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.JsonProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -28,7 +28,7 @@ public class DataResponse {
|
||||
public static class ResultData {
|
||||
|
||||
@JsonProperty("init_list")
|
||||
List<DynamodbDataInitializeHistory> dataInitList;
|
||||
List<APILogInfo> dataInitList;
|
||||
|
||||
private String message;
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.caliverse.admin.domain.response;
|
||||
|
||||
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.JsonProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -28,7 +29,8 @@ public class HistoryResponse {
|
||||
private String message;
|
||||
|
||||
@JsonProperty("list")
|
||||
private List<Log> list ;
|
||||
// private List<Log> list ;
|
||||
private List<HistoryLogInfoBase> list ;
|
||||
|
||||
private String content; // db에 text유형의 데이터를 가져옴
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ public class ItemsResponse {
|
||||
@Data
|
||||
@Builder
|
||||
public static class Item{
|
||||
private Integer id;
|
||||
private String id;
|
||||
@JsonProperty("user_guid")
|
||||
private String userGuid;
|
||||
@JsonProperty("item_guid")
|
||||
|
||||
@@ -4,7 +4,6 @@ import com.caliverse.admin.domain.adminlog.AdminPasswordInitLog;
|
||||
import com.caliverse.admin.domain.adminlog.IAdminLog;
|
||||
import com.caliverse.admin.domain.dao.admin.AdminMapper;
|
||||
import com.caliverse.admin.domain.dao.admin.GroupMapper;
|
||||
import com.caliverse.admin.domain.dao.admin.HistoryMapper;
|
||||
import com.caliverse.admin.domain.entity.*;
|
||||
import com.caliverse.admin.domain.request.AdminRequest;
|
||||
import com.caliverse.admin.domain.request.AuthenticateRequest;
|
||||
@@ -12,8 +11,10 @@ import com.caliverse.admin.domain.response.AdminResponse;
|
||||
import com.caliverse.admin.global.common.code.CommonCode;
|
||||
import com.caliverse.admin.global.common.code.ErrorCode;
|
||||
import com.caliverse.admin.global.common.code.SuccessCode;
|
||||
import com.caliverse.admin.global.common.constants.MysqlConstants;
|
||||
import com.caliverse.admin.global.common.exception.RestApiException;
|
||||
import com.caliverse.admin.global.common.utils.CommonUtils;
|
||||
import com.caliverse.admin.mongodb.service.MysqlHistoryLogService;
|
||||
import jakarta.mail.internet.MimeMessage;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -38,6 +39,7 @@ import java.util.*;
|
||||
public class AdminService {
|
||||
private static final Logger logger = LoggerFactory.getLogger(AdminService.class);
|
||||
|
||||
private final MysqlHistoryLogService mysqlHistoryLogService;
|
||||
private final AdminMapper adminMapper;
|
||||
private final GroupMapper groupMapper;
|
||||
private final PasswordEncoder passwordEncoder;
|
||||
@@ -171,8 +173,9 @@ public class AdminService {
|
||||
Map<String , Object> map = new HashMap<>();
|
||||
adminRequest.getList().forEach(
|
||||
item -> {
|
||||
|
||||
map.put("email", item.getEmail());
|
||||
String email = item.getEmail();
|
||||
Optional<Admin> info = adminMapper.findByEmail(email);
|
||||
map.put("email", email);
|
||||
map.put("id", CommonUtils.getAdmin().getId());
|
||||
|
||||
if(item.getIsApprove().equals(AdminRequest.Approve.APPROVE)){
|
||||
@@ -185,18 +188,13 @@ public class AdminService {
|
||||
//로그인 승인
|
||||
adminMapper.updateStatus(map);
|
||||
|
||||
//로그 기록
|
||||
Optional<Admin> admin = adminMapper.findByEmail(item.getEmail());
|
||||
// map.put("adminId", admin.get().getId());
|
||||
// map.put("name", CommonUtils.getAdmin().getName());
|
||||
// map.put("mail", CommonUtils.getAdmin().getEmail());
|
||||
// map.put("type", HISTORYTYPE.LOGIN_PERMITTED);
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("name",admin.get().getName());
|
||||
jsonObject.put("email",item.getEmail());
|
||||
// map.put("content",jsonObject.toString());
|
||||
// historyMapper.saveLog(map);
|
||||
historyService.setLog(HISTORYTYPE.LOGIN_PERMITTED, jsonObject);
|
||||
mysqlHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPEDETAIL.LOGIN_PERMITTED,
|
||||
MysqlConstants.TABLE_NAME_ADMIN,
|
||||
HISTORYTYPEDETAIL.LOGIN_PERMITTED.name(),
|
||||
info.get(),
|
||||
adminMapper.findByEmail(email)
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
@@ -215,32 +213,24 @@ public class AdminService {
|
||||
Map<String , Object> map = new HashMap<>();
|
||||
adminRequest.getList().forEach(
|
||||
item -> {
|
||||
map.put("email", item.getEmail());
|
||||
String email = item.getEmail();
|
||||
map.put("email", email);
|
||||
map.put("group_id", item.getGroupId());
|
||||
map.put("id", CommonUtils.getAdmin().getId());
|
||||
|
||||
//변경전 그룹 명세 조회
|
||||
Optional<Admin> admin = adminMapper.findByEmail(item.getEmail());
|
||||
Optional<Admin> info = adminMapper.findByEmail(email);
|
||||
|
||||
Map<String, String> beforeGroup = groupMapper.getGroupInfo(admin.get().getGroupId());
|
||||
//쿼리 실행
|
||||
adminMapper.updateGroup(map);
|
||||
//로그 기록
|
||||
//변경후 그룹 명세 조회
|
||||
Map<String, String> afterGroup = groupMapper.getGroupInfo(item.getGroupId());
|
||||
|
||||
// map.put("adminId", CommonUtils.getAdmin().getId());
|
||||
// map.put("name", CommonUtils.getAdmin().getName());
|
||||
// map.put("mail", CommonUtils.getAdmin().getEmail());
|
||||
// map.put("type", HISTORYTYPE.ADMIN_INFO_UPDATE);
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("name",admin.get().getName());
|
||||
jsonObject.put("email",item.getEmail());
|
||||
jsonObject.put("Authority(Before)", beforeGroup != null?beforeGroup.get("name"):"");
|
||||
jsonObject.put("Authority(after)", afterGroup != null? afterGroup.get("name"):"");
|
||||
// map.put("content",jsonObject.toString());
|
||||
// historyMapper.saveLog(map);
|
||||
historyService.setLog(HISTORYTYPE.ADMIN_INFO_UPDATE, jsonObject);
|
||||
mysqlHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPEDETAIL.ADMIN_INFO_UPDATE,
|
||||
MysqlConstants.TABLE_NAME_ADMIN,
|
||||
HISTORYTYPEDETAIL.ADMIN_INFO_UPDATE.name(),
|
||||
info.get(),
|
||||
adminMapper.findByEmail(email)
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
@@ -261,21 +251,17 @@ public class AdminService {
|
||||
map.put("email", item.getEmail());
|
||||
map.put("deleted", String.valueOf(1));
|
||||
//로그 기록
|
||||
Optional<Admin> admin = adminMapper.findByEmail(item.getEmail());
|
||||
Optional<Admin> info = adminMapper.findByEmail(item.getEmail());
|
||||
|
||||
//쿼리 실행
|
||||
adminMapper.deleteAdmin(map);
|
||||
|
||||
// map.put("adminId", CommonUtils.getAdmin().getId());
|
||||
// map.put("name", CommonUtils.getAdmin().getName());
|
||||
// map.put("mail", CommonUtils.getAdmin().getEmail());
|
||||
// map.put("type", HISTORYTYPE.ADMIN_INFO_DELETE);
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("name",admin.get().getName());
|
||||
jsonObject.put("email",item.getEmail());
|
||||
// map.put("content",jsonObject.toString());
|
||||
// historyMapper.saveLog(map);
|
||||
historyService.setLog(HISTORYTYPE.ADMIN_INFO_DELETE, jsonObject);
|
||||
mysqlHistoryLogService.deleteHistoryLog(
|
||||
HISTORYTYPEDETAIL.ADMIN_INFO_DELETE,
|
||||
MysqlConstants.TABLE_NAME_ADMIN,
|
||||
HISTORYTYPEDETAIL.ADMIN_INFO_DELETE.name(),
|
||||
info.get()
|
||||
);
|
||||
}
|
||||
);
|
||||
log.info("deleteAdmin Deleted Admin: {}", map);
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.caliverse.admin.domain.service;
|
||||
import com.caliverse.admin.domain.dao.admin.BattleMapper;
|
||||
import com.caliverse.admin.domain.datacomponent.MetaDataHandler;
|
||||
import com.caliverse.admin.domain.entity.BattleEvent;
|
||||
import com.caliverse.admin.domain.entity.HISTORYTYPE;
|
||||
import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
|
||||
import com.caliverse.admin.domain.entity.metadata.MetaBattleConfigData;
|
||||
import com.caliverse.admin.domain.entity.metadata.MetaBattleRewardData;
|
||||
import com.caliverse.admin.domain.request.BattleEventRequest;
|
||||
@@ -15,7 +15,7 @@ import com.caliverse.admin.global.common.code.SuccessCode;
|
||||
import com.caliverse.admin.global.common.constants.CommonConstants;
|
||||
import com.caliverse.admin.global.common.constants.MysqlConstants;
|
||||
import com.caliverse.admin.global.common.utils.CommonUtils;
|
||||
import com.caliverse.admin.history.service.MysqlHistoryLogService;
|
||||
import com.caliverse.admin.mongodb.service.MysqlHistoryLogService;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -130,6 +130,18 @@ public class BattleEventService {
|
||||
}
|
||||
battleEventRequest.setInstanceId(CommonConstants.BATTLE_INSTANCE_ID); //고정값으로 넣고 추후 맵정보가 늘어나면 선택하는 걸로
|
||||
|
||||
if(battleEventRequest.getRoundTime().equals(0)
|
||||
|| battleEventRequest.getHotTime().equals(0)
|
||||
|| battleEventRequest.getConfigId().equals(0)
|
||||
|| battleEventRequest.getRoundCount().equals(0)
|
||||
|| battleEventRequest.getRewardGroupId().equals(0)
|
||||
){
|
||||
return BattleEventResponse.builder()
|
||||
.status(CommonCode.ERROR.getHttpStatus())
|
||||
.result(ErrorCode.ERROR_BATTLE_EVENT_TIME_OVER.toString())
|
||||
.build();
|
||||
}
|
||||
|
||||
int operation_time = calcEndTime(battleEventRequest);
|
||||
battleEventRequest.setEventOperationTime(operation_time);
|
||||
|
||||
@@ -158,12 +170,10 @@ public class BattleEventService {
|
||||
BattleEvent event_info = battleMapper.getBattleEventDetail(battle_event_id);
|
||||
|
||||
mysqlHistoryLogService.insertHistoryLog(
|
||||
HISTORYTYPE.BATTLE_EVENT_ADD,
|
||||
HISTORYTYPEDETAIL.BATTLE_EVENT_ADD,
|
||||
MysqlConstants.TABLE_NAME_BATTLE_EVENT,
|
||||
HISTORYTYPE.BATTLE_EVENT_ADD.name(),
|
||||
event_info,
|
||||
CommonUtils.getAdmin().getEmail(),
|
||||
CommonUtils.getClientIp()
|
||||
HISTORYTYPEDETAIL.BATTLE_EVENT_ADD.name(),
|
||||
event_info
|
||||
);
|
||||
|
||||
dynamodbBattleEventService.insertBattleEvent(battleEventRequest);
|
||||
@@ -222,13 +232,11 @@ public class BattleEventService {
|
||||
BattleEvent after_info = battleMapper.getBattleEventDetail(id);
|
||||
|
||||
mysqlHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPE.BATTLE_EVENT_UPDATE,
|
||||
HISTORYTYPEDETAIL.BATTLE_EVENT_UPDATE,
|
||||
MysqlConstants.TABLE_NAME_BATTLE_EVENT,
|
||||
HISTORYTYPE.BATTLE_EVENT_UPDATE.name(),
|
||||
HISTORYTYPEDETAIL.BATTLE_EVENT_UPDATE.name(),
|
||||
before_info,
|
||||
after_info,
|
||||
CommonUtils.getAdmin().getEmail(),
|
||||
CommonUtils.getClientIp()
|
||||
after_info
|
||||
);
|
||||
|
||||
dynamodbBattleEventService.updateBattleEvent(battleEventRequest);
|
||||
@@ -265,13 +273,11 @@ public class BattleEventService {
|
||||
}
|
||||
|
||||
mysqlHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPE.BATTLE_EVENT_UPDATE,
|
||||
HISTORYTYPEDETAIL.BATTLE_EVENT_UPDATE,
|
||||
MysqlConstants.TABLE_NAME_BATTLE_EVENT,
|
||||
HISTORYTYPE.BATTLE_EVENT_UPDATE.name(),
|
||||
HISTORYTYPEDETAIL.BATTLE_EVENT_UPDATE.name(),
|
||||
info,
|
||||
battleMapper.getBattleEventDetail(id),
|
||||
CommonUtils.getAdmin().getEmail(),
|
||||
CommonUtils.getClientIp()
|
||||
battleMapper.getBattleEventDetail(id)
|
||||
);
|
||||
|
||||
dynamodbBattleEventService.updateStopBattleEvent(info);
|
||||
@@ -305,12 +311,10 @@ public class BattleEventService {
|
||||
log.info("BattleEvent Delete Complete: {}", item);
|
||||
|
||||
mysqlHistoryLogService.deleteHistoryLog(
|
||||
HISTORYTYPE.BATTLE_EVENT_DELETE,
|
||||
HISTORYTYPEDETAIL.BATTLE_EVENT_DELETE,
|
||||
MysqlConstants.TABLE_NAME_BATTLE_EVENT,
|
||||
HISTORYTYPE.BATTLE_EVENT_DELETE.name(),
|
||||
info,
|
||||
CommonUtils.getAdmin().getEmail(),
|
||||
CommonUtils.getClientIp()
|
||||
HISTORYTYPEDETAIL.BATTLE_EVENT_DELETE.name(),
|
||||
info
|
||||
);
|
||||
|
||||
// dynamodbLandAuctionService.cancelLandAuction(auction_info);
|
||||
|
||||
@@ -1,20 +1,22 @@
|
||||
package com.caliverse.admin.domain.service;
|
||||
|
||||
import com.caliverse.admin.domain.dao.admin.BlackListMapper;
|
||||
import com.caliverse.admin.domain.dao.admin.HistoryMapper;
|
||||
import com.caliverse.admin.domain.entity.BlackList;
|
||||
import com.caliverse.admin.domain.entity.HISTORYTYPE;
|
||||
import com.caliverse.admin.domain.entity.Excel;
|
||||
import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
|
||||
import com.caliverse.admin.domain.request.BlackListRequest;
|
||||
import com.caliverse.admin.domain.response.BlackListResponse;
|
||||
import com.caliverse.admin.dynamodb.service.DynamodbUserService;
|
||||
import com.caliverse.admin.global.common.code.CommonCode;
|
||||
import com.caliverse.admin.global.common.code.ErrorCode;
|
||||
import com.caliverse.admin.global.common.code.SuccessCode;
|
||||
import com.caliverse.admin.global.common.constants.CommonConstants;
|
||||
import com.caliverse.admin.global.common.constants.MysqlConstants;
|
||||
import com.caliverse.admin.global.common.exception.RestApiException;
|
||||
import com.caliverse.admin.global.common.utils.CommonUtils;
|
||||
import com.caliverse.admin.global.common.utils.ExcelUtils;
|
||||
import com.caliverse.admin.mongodb.service.MysqlHistoryLogService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.json.JSONObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
@@ -35,10 +37,8 @@ public class BlackListService {
|
||||
private static final Logger logger = LoggerFactory.getLogger(BlackListService.class);
|
||||
private final BlackListMapper blackListMapper;
|
||||
private final ExcelUtils excelUtils;
|
||||
private final HistoryMapper historyMapper;
|
||||
private final HistoryService historyService;
|
||||
private final DynamoDBService dynamoDBService;
|
||||
private final DynamodbUserService dynamodbUserService;
|
||||
private final MysqlHistoryLogService mysqlHistoryLogService;
|
||||
@Value("${caliverse.file}")
|
||||
private String excelPath;
|
||||
private final ResourceLoader resourceLoader;
|
||||
@@ -85,10 +85,10 @@ public class BlackListService {
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.NOT_EXIT_EXCEL.getMessage() );
|
||||
}
|
||||
|
||||
List<String> listData = excelUtils.getListData(file, 1, 0);
|
||||
List<Excel> listData = excelUtils.getListData(file);
|
||||
|
||||
// 엑셀 파일내 중복된 데이터 있는지 체크
|
||||
if(excelUtils.hasDuplicates(listData)){
|
||||
if(excelUtils.hasDuplicatesExcel(listData)){
|
||||
//중복된 유저 정보가 있습니다.
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DUPLICATE_EXCEL.getMessage() );
|
||||
}
|
||||
@@ -96,28 +96,27 @@ public class BlackListService {
|
||||
listData.forEach(item->{
|
||||
|
||||
BlackList blackList = new BlackList();
|
||||
blackList.setGuid(item);
|
||||
//gameDB에서 닉네임, isWhiteUser, isBlackUser 조회
|
||||
String nickName = dynamodbUserService.getGuidByName(item);
|
||||
if(nickName != ""){
|
||||
|
||||
String user = item.getUser();
|
||||
boolean isGuid = true;
|
||||
if(item.getType().equals(CommonConstants.NICKNAME)){
|
||||
blackList.setNickname(user);
|
||||
String guid = dynamodbUserService.getNameByGuid(user);
|
||||
if(guid == null || guid.isEmpty()) isGuid = false;
|
||||
blackList.setGuid(guid);
|
||||
}else{
|
||||
isGuid = dynamodbUserService.isUser(user);
|
||||
blackList.setGuid(user);
|
||||
String nickName = dynamodbUserService.getGuidByName(user);
|
||||
blackList.setNickname(nickName);
|
||||
}
|
||||
|
||||
//adminDB 에 데이터 있는지 체크
|
||||
int cnt = blackListMapper.getCountByGuid(item);
|
||||
//gameDB isWhiteUser 값 체크
|
||||
// boolean isBlackUser = dynamoDBService.isWhiteOrBlackUser(item);
|
||||
boolean isBlackUser = dynamodbUserService.isBlockUser(item);
|
||||
boolean isGuid = dynamoDBService.isGuidChecked(item);
|
||||
int cnt = blackListMapper.getCountByGuid(blackList.getGuid());
|
||||
boolean isBlackUser = dynamodbUserService.isBlockUser(blackList.getGuid());
|
||||
|
||||
// //guid 검증
|
||||
// if(blackAttr.size() == 0){
|
||||
// throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.GUID_CHECK.getMessage());
|
||||
// }
|
||||
//
|
||||
// boolean isBlackUser = dynamoDBService.isWhiteOrBlackUser(blackAttr.get("isBlackUser"));
|
||||
if(cnt == 0){
|
||||
if(isBlackUser || isGuid){
|
||||
if(isBlackUser || !isGuid){
|
||||
blackList.setValidate(false);
|
||||
}else{
|
||||
blackList.setValidate(true);
|
||||
@@ -157,10 +156,10 @@ public class BlackListService {
|
||||
item->{
|
||||
if(item.getGuid() != null){
|
||||
String guid = item.getGuid();
|
||||
if(dynamoDBService.isGuidChecked(guid)){
|
||||
if(!dynamodbUserService.isUser(guid)){
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.WARNING_GUID_CHECK.toString());
|
||||
}
|
||||
// boolean isBlackUser = dynamoDBService.isWhiteOrBlackUser(guid);
|
||||
|
||||
boolean isBlackUser = dynamodbUserService.isBlockUser(guid);
|
||||
if(isBlackUser){
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.USER_BLOCK_REGIST_DUPLE_WARNING.toString());
|
||||
@@ -169,6 +168,15 @@ public class BlackListService {
|
||||
blackListRequest.setNickname(item.getNickname());
|
||||
blackListMapper.postBlackList(blackListRequest);
|
||||
logger.info("postBlackList insertBlackList: {}",blackListRequest);
|
||||
|
||||
BlackList info = blackListMapper.getBlackListDetail(blackListRequest.getId());
|
||||
|
||||
mysqlHistoryLogService.insertHistoryLog(
|
||||
HISTORYTYPEDETAIL.BLACKLIST_ADD,
|
||||
MysqlConstants.TABLE_NAME_USER_BLOCK,
|
||||
HISTORYTYPEDETAIL.BLACKLIST_ADD.name(),
|
||||
info
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -182,10 +190,10 @@ public class BlackListService {
|
||||
if(cnt > 0){
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.USER_BLOCK_REGIST_DUPLE_WARNING.toString());
|
||||
}
|
||||
if(dynamoDBService.isGuidChecked(item.getGuid())){
|
||||
if(!dynamodbUserService.isUser(item.getGuid())){
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.WARNING_GUID_CHECK.toString());
|
||||
}
|
||||
// boolean isBlackUser = dynamoDBService.isWhiteOrBlackUser(item.getGuid());
|
||||
|
||||
boolean isBlackUser = dynamodbUserService.isBlockUser(item.getGuid());
|
||||
if(isBlackUser){
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.USER_BLOCK_REGIST_DUPLE_WARNING.toString());
|
||||
@@ -194,6 +202,15 @@ public class BlackListService {
|
||||
blackListRequest.setNickname(dynamodbUserService.getGuidByName(item.getGuid()));
|
||||
blackListMapper.postBlackList(blackListRequest);
|
||||
logger.info("postBlackList insertBlackList: {}",blackListRequest);
|
||||
|
||||
BlackList info = blackListMapper.getBlackListDetail(blackListRequest.getId());
|
||||
|
||||
mysqlHistoryLogService.insertHistoryLog(
|
||||
HISTORYTYPEDETAIL.BLACKLIST_ADD,
|
||||
MysqlConstants.TABLE_NAME_USER_BLOCK,
|
||||
HISTORYTYPEDETAIL.BLACKLIST_ADD.name(),
|
||||
info
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -214,31 +231,28 @@ public class BlackListService {
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
blackListRequest.getBlackList().forEach(
|
||||
item->{
|
||||
map.put("id",item.getId());
|
||||
long id = item.getId();
|
||||
BlackList blackList = blackListMapper.getBlackListDetail(id);
|
||||
|
||||
map.put("id",id);
|
||||
map.put("reason",item.getReason());
|
||||
blackListMapper.deleteBlackList(map);
|
||||
|
||||
//로그 기록
|
||||
BlackList blackList = blackListMapper.getBlackListDetail(Long.valueOf(item.getId()));
|
||||
map.put("adminId", CommonUtils.getAdmin().getId());
|
||||
map.put("name", CommonUtils.getAdmin().getName());
|
||||
map.put("mail", CommonUtils.getAdmin().getEmail());
|
||||
map.put("type", HISTORYTYPE.BLACKLIST_DELETE);
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("guid",blackList.getGuid());
|
||||
jsonObject.put("name","");
|
||||
|
||||
map.put("content",jsonObject.toString());
|
||||
historyMapper.saveLog(map);
|
||||
//dynamoDB char# 테이블에 isBlackUser : false 값을 insert
|
||||
// dynamoDBService.insertUpdateData(blackList.getGuid(),"isBlackUser", false);
|
||||
logger.info("deleteBlackList delete: {}",map);
|
||||
if(blackList.getStatus().equals(BlackList.STATUSTYPE.INPROGRESS))
|
||||
|
||||
mysqlHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPEDETAIL.BLACKLIST_DELETE,
|
||||
MysqlConstants.TABLE_NAME_USER_BLOCK,
|
||||
HISTORYTYPEDETAIL.BLACKLIST_DELETE.name(),
|
||||
blackList,
|
||||
blackListMapper.getBlackListDetail(id)
|
||||
);
|
||||
|
||||
if(dynamodbUserService.isBlockUser(blackList.getGuid()))
|
||||
dynamodbUserService.updateBlockUser(BlackList.STATUSTYPE.EXPIRATION, blackList);
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
|
||||
return BlackListResponse.builder()
|
||||
.resultData(BlackListResponse.ResultData.builder()
|
||||
.message(SuccessCode.DELETE.getMessage()).build())
|
||||
@@ -254,6 +268,7 @@ public class BlackListService {
|
||||
map.put("status", status);
|
||||
|
||||
blackListMapper.updateStatus(map);
|
||||
|
||||
logger.info("updateBlackListStatus BlackListSchedule status update: {}",map);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.caliverse.admin.domain.entity.web3.ResponseErrorCode;
|
||||
import com.caliverse.admin.domain.entity.web3.ResponseRequestData;
|
||||
import com.caliverse.admin.domain.entity.web3.ResponseWithdrawableData;
|
||||
import com.caliverse.admin.domain.request.CaliumRequest;
|
||||
import com.caliverse.admin.domain.request.LogGenericRequest;
|
||||
import com.caliverse.admin.domain.request.Web3Request;
|
||||
import com.caliverse.admin.domain.response.CaliumResponse;
|
||||
import com.caliverse.admin.domain.response.Web3Response;
|
||||
@@ -17,7 +18,10 @@ import com.caliverse.admin.global.common.code.SuccessCode;
|
||||
import com.caliverse.admin.global.common.constants.MysqlConstants;
|
||||
import com.caliverse.admin.global.common.constants.Web3Constants;
|
||||
import com.caliverse.admin.global.common.utils.CommonUtils;
|
||||
import com.caliverse.admin.history.service.MysqlHistoryLogService;
|
||||
import com.caliverse.admin.logs.Indicatordomain.GenericMongoLog;
|
||||
import com.caliverse.admin.logs.entity.LogAction;
|
||||
import com.caliverse.admin.logs.logservice.businesslogservice.BusinessLogGenericService;
|
||||
import com.caliverse.admin.mongodb.service.MysqlHistoryLogService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.json.JSONObject;
|
||||
@@ -25,6 +29,7 @@ import org.springframework.http.HttpMethod;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -41,6 +46,7 @@ public class CaliumService {
|
||||
// private final DynamoDBService dynamoDBService;
|
||||
private final DynamodbCaliumService dynamodbCaliumService;
|
||||
private final MysqlHistoryLogService mysqlHistoryLogService;
|
||||
private final BusinessLogGenericService businessLogGenericService;
|
||||
|
||||
public CaliumResponse getCaliumLimit(){
|
||||
Web3Response<ResponseWithdrawableData> web3Response = web3Service.get(
|
||||
@@ -82,6 +88,13 @@ public class CaliumService {
|
||||
double allCnt = caliumMapper.getCaliumTotal();
|
||||
double stock_qty = dynamodbCaliumService.getCaliumTotal();
|
||||
|
||||
LogGenericRequest logGenericRequest = new LogGenericRequest();
|
||||
logGenericRequest.setLogAction(LogAction.FailCaliumEchoSystem);
|
||||
logGenericRequest.setStartDt(LocalDateTime.now().minusDays(1));
|
||||
logGenericRequest.setEndDt(LocalDateTime.now());
|
||||
logGenericRequest.setOrderBy("ASC");
|
||||
List<GenericMongoLog> failList = businessLogGenericService.loadBusinessLogData(logGenericRequest, GenericMongoLog.class);
|
||||
|
||||
return CaliumResponse.builder()
|
||||
.status(CommonCode.SUCCESS.getHttpStatus())
|
||||
.result(CommonCode.SUCCESS.getResult())
|
||||
@@ -89,6 +102,7 @@ public class CaliumService {
|
||||
.caliumList(list)
|
||||
.total(stock_qty)
|
||||
.totalAll(allCnt)
|
||||
.failCount(failList.size())
|
||||
.pageNo(requestParam.get("page_no")!=null?
|
||||
Integer.parseInt(requestParam.get("page_no").toString()):1)
|
||||
.build()
|
||||
@@ -147,21 +161,12 @@ public class CaliumService {
|
||||
Calium calium = caliumMapper.getCaliumRequestDetail(caliumRequest.getId());
|
||||
|
||||
mysqlHistoryLogService.insertHistoryLog(
|
||||
HISTORYTYPE.CALIUM_ADD,
|
||||
HISTORYTYPEDETAIL.CALIUM_ADD,
|
||||
MysqlConstants.TABLE_NAME_CALIUM_REQUEST,
|
||||
HISTORYTYPE.CALIUM_ADD.name(),
|
||||
calium,
|
||||
CommonUtils.getAdmin().getEmail(),
|
||||
CommonUtils.getClientIp()
|
||||
HISTORYTYPEDETAIL.CALIUM_ADD.name(),
|
||||
calium
|
||||
);
|
||||
|
||||
//로그 기록
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("dept",caliumRequest.getDept());
|
||||
jsonObject.put("count",caliumRequest.getCount());
|
||||
jsonObject.put("content",caliumRequest.getContent());
|
||||
historyService.setLog(HISTORYTYPE.CALIUM_ADD, jsonObject);
|
||||
|
||||
return CaliumResponse.builder()
|
||||
.status(CommonCode.SUCCESS.getHttpStatus())
|
||||
.result(CommonCode.SUCCESS.getResult())
|
||||
@@ -175,10 +180,10 @@ public class CaliumService {
|
||||
public CaliumResponse updateCaliumCharged(CaliumRequest caliumRequest){
|
||||
log.info("updateCaliumCharged calium Request: {}", caliumRequest);
|
||||
Calium calium = caliumMapper.getCaliumRequestDetail(caliumRequest.getId());
|
||||
Long id = CommonUtils.getAdmin().getId();
|
||||
Long userId = CommonUtils.getAdmin().getId();
|
||||
// 상태가 승인완료거나 요청한 본인이 아니면 에러처리
|
||||
if(!calium.getStatus().equals(Calium.CALIUMREQUESTSTATUS.COMPLETE) || !calium.getCreateBy().equals(id.toString())){
|
||||
log.error("updateCaliumCharged Calium Request Status or User Not Match status: {}, id: {}", calium.getStatus(), id);
|
||||
if(!calium.getStatus().equals(Calium.CALIUMREQUESTSTATUS.COMPLETE) || !calium.getCreateBy().equals(userId.toString())){
|
||||
log.error("updateCaliumCharged Calium Request Status or User Not Match status: {}, id: {}", calium.getStatus(), userId);
|
||||
return CaliumResponse.builder()
|
||||
.status(CommonCode.ERROR.getHttpStatus())
|
||||
.result(ErrorCode.ERROR_CALIUM_FINISH.toString())
|
||||
@@ -188,14 +193,24 @@ public class CaliumService {
|
||||
.build();
|
||||
}
|
||||
|
||||
Calium info = caliumMapper.getCaliumRequestDetail(caliumRequest.getId());
|
||||
|
||||
dynamodbCaliumService.updateCaliumTotal(caliumRequest.getCount());
|
||||
|
||||
updateCaliumRequest(caliumRequest.getId(), Calium.CALIUMREQUESTSTATUS.FINISH);
|
||||
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
mysqlHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPEDETAIL.CALIUM_TOTAL_UPDATE,
|
||||
MysqlConstants.TABLE_NAME_CALIUM_REQUEST,
|
||||
HISTORYTYPEDETAIL.CALIUM_TOTAL_UPDATE.name(),
|
||||
info,
|
||||
caliumMapper.getCaliumRequestDetail(caliumRequest.getId())
|
||||
);
|
||||
|
||||
// JSONObject jsonObject = new JSONObject();
|
||||
// jsonObject.put("dynamoDB_update",dynamoResult);
|
||||
|
||||
historyService.setLog(HISTORYTYPE.CALIUM_TOTAL_UPDATE, jsonObject);
|
||||
// historyService.setLog(HISTORYTYPEDETAIL.CALIUM_TOTAL_UPDATE, jsonObject);
|
||||
|
||||
return CaliumResponse.builder()
|
||||
.status(CommonCode.SUCCESS.getHttpStatus())
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.caliverse.admin.domain.service;
|
||||
import com.caliverse.admin.domain.dao.admin.DataMapper;
|
||||
import com.caliverse.admin.domain.dao.admin.LandMapper;
|
||||
import com.caliverse.admin.domain.entity.*;
|
||||
import com.caliverse.admin.domain.request.AuthenticateRequest;
|
||||
import com.caliverse.admin.domain.request.DataRequest;
|
||||
import com.caliverse.admin.domain.request.LogGenericRequest;
|
||||
import com.caliverse.admin.domain.response.DataResponse;
|
||||
import com.caliverse.admin.dynamodb.service.DynamodbDataService;
|
||||
@@ -12,10 +12,9 @@ import com.caliverse.admin.global.common.code.ErrorCode;
|
||||
import com.caliverse.admin.global.common.code.SuccessCode;
|
||||
import com.caliverse.admin.global.common.constants.MysqlConstants;
|
||||
import com.caliverse.admin.global.common.utils.CommonUtils;
|
||||
import com.caliverse.admin.global.component.transaction.TransactionIdManager;
|
||||
import com.caliverse.admin.history.domain.DynamodbDataInitializeHistory;
|
||||
import com.caliverse.admin.history.service.DataInitializeHistoryService;
|
||||
import com.caliverse.admin.history.service.MysqlHistoryLogService;
|
||||
import com.caliverse.admin.mongodb.domain.APILogInfo;
|
||||
import com.caliverse.admin.mongodb.service.DataInitializeHistoryService;
|
||||
import com.caliverse.admin.mongodb.service.MysqlHistoryLogService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.data.mongodb.UncategorizedMongoDbException;
|
||||
@@ -38,7 +37,7 @@ public class DataService {
|
||||
private final LandMapper landMapper;
|
||||
private final DataMapper dataMapper;
|
||||
private final DataInitializeHistoryService dataInitializeHistoryService;
|
||||
private final TransactionIdManager transactionIdManager;
|
||||
|
||||
|
||||
public DataResponse initHistoryList(LogGenericRequest logGenericRequest){
|
||||
|
||||
@@ -48,9 +47,9 @@ public class DataService {
|
||||
logGenericRequest.setStartDt(startDt);
|
||||
logGenericRequest.setEndDt(endDt);
|
||||
|
||||
List<DynamodbDataInitializeHistory> logList = new ArrayList<>();
|
||||
List<APILogInfo> logList = new ArrayList<>();
|
||||
try{
|
||||
logList = dataInitializeHistoryService.loadHistoryData(logGenericRequest, DynamodbDataInitializeHistory.class);
|
||||
logList = dataInitializeHistoryService.loadHistoryData(logGenericRequest, APILogInfo.class);
|
||||
}catch(UncategorizedMongoDbException e){
|
||||
if (e.getMessage().contains("Sort exceeded memory limit")) {
|
||||
log.error("MongoDB Query memory limit error: {}", e.getMessage());
|
||||
@@ -80,11 +79,19 @@ public class DataService {
|
||||
}
|
||||
|
||||
@Transactional(transactionManager = "transactionManager")
|
||||
public DataResponse initData(AuthenticateRequest authenticateRequest){
|
||||
EInitDataType dataType = authenticateRequest.getInitDataType();
|
||||
public DataResponse initData(DataRequest dataRequest){
|
||||
EInitDataType dataType = dataRequest.getInitDataType();
|
||||
dataRequest.setCreateBy(CommonUtils.getAdmin().getId());
|
||||
log.info("initData email: {}, initDataType: {}", CommonUtils.getAdmin().getEmail(), dataType);
|
||||
|
||||
dataMapper.postDataInit(dataType, CommonUtils.getAdmin().getId());
|
||||
dataMapper.postDataInit(dataRequest);
|
||||
|
||||
mysqlHistoryLogService.insertHistoryLog(
|
||||
HISTORYTYPEDETAIL.DATA_INIT_ADD,
|
||||
MysqlConstants.TABLE_NAME_DATA_INIT,
|
||||
HISTORYTYPEDETAIL.DATA_INIT_ADD.name(),
|
||||
dataMapper.getDataInitDetail(dataRequest.getId())
|
||||
);
|
||||
|
||||
// switch(dataType){
|
||||
// case LandAuction -> {
|
||||
@@ -130,30 +137,25 @@ public class DataService {
|
||||
landMapper.deleteMessage(map);
|
||||
|
||||
mysqlHistoryLogService.deleteHistoryLog(
|
||||
HISTORYTYPE.LAND_AUCTION_INITIALIZE,
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_INITIALIZE,
|
||||
MysqlConstants.TABLE_NAME_LAND_AUCTION,
|
||||
HISTORYTYPE.LAND_AUCTION_INITIALIZE.name(),
|
||||
landAuction,
|
||||
CommonUtils.getAdmin() == null ? "" : CommonUtils.getAdmin().getEmail(),
|
||||
CommonUtils.getClientIp() == null ? "" : CommonUtils.getClientIp()
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_INITIALIZE.name(),
|
||||
landAuction
|
||||
);
|
||||
if (!message.isEmpty()) {
|
||||
mysqlHistoryLogService.deleteHistoryLog(
|
||||
HISTORYTYPE.LAND_AUCTION_INITIALIZE,
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_INITIALIZE,
|
||||
MysqlConstants.TABLE_NAME_MESSAGE,
|
||||
HISTORYTYPE.LAND_AUCTION_INITIALIZE.name(),
|
||||
message,
|
||||
CommonUtils.getAdmin() == null ? "" : CommonUtils.getAdmin().getEmail(),
|
||||
CommonUtils.getClientIp() == null ? "" : CommonUtils.getClientIp()
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_INITIALIZE.name(),
|
||||
message
|
||||
);
|
||||
}
|
||||
|
||||
dataInitializeHistoryService.mysqlDataInitHistory(
|
||||
EInitDataType.LandAuction,
|
||||
MysqlConstants.TABLE_NAME_LAND_AUCTION,
|
||||
transactionIdManager.getCurrentTransactionId(),
|
||||
true,
|
||||
"",
|
||||
"SUCCESS",
|
||||
landAuction
|
||||
);
|
||||
|
||||
@@ -162,7 +164,6 @@ public class DataService {
|
||||
dataInitializeHistoryService.mysqlDataInitHistory(
|
||||
EInitDataType.LandAuction,
|
||||
MysqlConstants.TABLE_NAME_LAND_AUCTION,
|
||||
transactionIdManager.getCurrentTransactionId(),
|
||||
false,
|
||||
e.getMessage(),
|
||||
landAuction
|
||||
@@ -176,20 +177,17 @@ public class DataService {
|
||||
landMapper.initLandOwnedChanges(id);
|
||||
|
||||
mysqlHistoryLogService.deleteHistoryLog(
|
||||
HISTORYTYPE.LAND_OWNED_INITIALIZE,
|
||||
HISTORYTYPEDETAIL.LAND_OWNED_INITIALIZE,
|
||||
MysqlConstants.TABLE_NAME_LAND_OWNER_CHANGE,
|
||||
HISTORYTYPE.LAND_OWNED_INITIALIZE.name(),
|
||||
landOwnerChange,
|
||||
CommonUtils.getAdmin() == null ? "" : CommonUtils.getAdmin().getEmail(),
|
||||
CommonUtils.getClientIp() == null ? "" : CommonUtils.getClientIp()
|
||||
HISTORYTYPEDETAIL.LAND_OWNED_INITIALIZE.name(),
|
||||
landOwnerChange
|
||||
);
|
||||
|
||||
dataInitializeHistoryService.mysqlDataInitHistory(
|
||||
EInitDataType.LandOwned,
|
||||
MysqlConstants.TABLE_NAME_LAND_OWNER_CHANGE,
|
||||
transactionIdManager.getCurrentTransactionId(),
|
||||
true,
|
||||
"",
|
||||
"SUCCESS",
|
||||
landOwnerChange
|
||||
);
|
||||
}catch(Exception e){
|
||||
@@ -197,7 +195,6 @@ public class DataService {
|
||||
dataInitializeHistoryService.mysqlDataInitHistory(
|
||||
EInitDataType.LandOwned,
|
||||
MysqlConstants.TABLE_NAME_LAND_OWNER_CHANGE,
|
||||
transactionIdManager.getCurrentTransactionId(),
|
||||
false,
|
||||
e.getMessage(),
|
||||
landOwnerChange
|
||||
|
||||
@@ -90,11 +90,11 @@ public class DynamoDBService {
|
||||
}
|
||||
|
||||
// guid check
|
||||
public boolean isGuidChecked(String guid) {
|
||||
Map<String, AttributeValue> item = getItem("user_base#"+guid,"empty");
|
||||
|
||||
return item.isEmpty();
|
||||
}
|
||||
// public boolean isGuidChecked(String guid) {
|
||||
// Map<String, AttributeValue> item = getItem("user_base#"+guid,"empty");
|
||||
//
|
||||
// return item.isEmpty();
|
||||
// }
|
||||
|
||||
|
||||
// public Map<String, Object> getAccountInfo(String guid){
|
||||
@@ -274,125 +274,6 @@ public class DynamoDBService {
|
||||
});
|
||||
}
|
||||
|
||||
public boolean isWhiteOrBlackUser(String accountId){
|
||||
String key = "PK = :pkValue";
|
||||
Map<String, AttributeValue> values = Map.of(":pkValue", AttributeValue.builder().s("account_base#"+accountId).build());
|
||||
AtomicBoolean isFlag = new AtomicBoolean(false);
|
||||
|
||||
excuteItems(executeQuery(key, values), "AccountBaseAttrib")
|
||||
.forEach(attrMap -> {
|
||||
String[] blockPolicy = CommonUtils.objectToStringArray(attrMap.get("block_policy"));
|
||||
|
||||
if(Arrays.stream(blockPolicy).findAny().isEmpty()){
|
||||
isFlag.set(false);
|
||||
}else{
|
||||
isFlag.set(true);
|
||||
}
|
||||
});
|
||||
|
||||
return isFlag.get();
|
||||
// if (attributeValue == null || attributeValue.s() == null) {
|
||||
// // 속성 값이 없거나 문자열이 아닌 경우에 대한 처리
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// // 속성 값을 문자열로 가져옴
|
||||
// String isFlag = attributeValue.s();
|
||||
//
|
||||
// // "true" 문자열과 대소문자 구분 없이 비교하여 boolean 값으로 반환
|
||||
// return isFlag.equalsIgnoreCase("true");
|
||||
// if(attr == null) return false;
|
||||
|
||||
|
||||
}
|
||||
|
||||
// 닉네임 변경
|
||||
public void updateNickname(String guid,String nickname,String newNickname){
|
||||
try{
|
||||
// char#guid 에서 CharInfo-> DisplayName 변경
|
||||
updateCharInfo(guid, newNickname);
|
||||
|
||||
// nickname#xxx 에서 Attr-> AccountId 변경
|
||||
createNewNickName(guid,newNickname);
|
||||
|
||||
// 기존 nickname 항목 삭제 처리
|
||||
deleteNickname(nickname);
|
||||
}catch (Exception e){
|
||||
log.error("updateNickname: {}", e.getMessage());
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage() );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void updateCharInfo(String guid, String newNickname) throws JsonProcessingException {
|
||||
|
||||
// 기존 CharInfo 값 가져오기
|
||||
Map<String, AttributeValue> item = getItem("char#" + guid, "char#" + guid);
|
||||
String charInfoJson = item.get("CharInfo").s();
|
||||
|
||||
// CharInfo JSON 문자열을 파싱
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
JsonNode charInfoNode = objectMapper.readTree(charInfoJson);
|
||||
|
||||
// 원하는 속성 변경
|
||||
((ObjectNode) charInfoNode).put("DisplayName", newNickname);
|
||||
|
||||
// 변경된 CharInfo JSON 문자열
|
||||
String updatedCharInfoJson = charInfoNode.toString();
|
||||
|
||||
// 업데이트할 내용을 정의
|
||||
Map<String, AttributeValue> expressionAttributeValues = new HashMap<>();
|
||||
expressionAttributeValues.put(":newNickName", AttributeValue.builder().s(updatedCharInfoJson).build());
|
||||
|
||||
// 업데이트 표현식을 정의
|
||||
String updateExpression = "SET CharInfo = :newNickName";
|
||||
// 업데이트 요청 생성
|
||||
UpdateItemRequest updateRequest = UpdateItemRequest.builder()
|
||||
.tableName(metaTable)
|
||||
.key(Map.of(
|
||||
"PK", AttributeValue.builder().s("char#" + guid).build(),
|
||||
"SK", AttributeValue.builder().s("char#" + guid).build()))
|
||||
.updateExpression(updateExpression)
|
||||
.expressionAttributeValues(expressionAttributeValues)
|
||||
.returnValues(ReturnValue.ALL_NEW) // 업데이트 후의 값을 반환하려면 지정
|
||||
.build();
|
||||
|
||||
|
||||
dynamoDbClient.updateItem(updateRequest);
|
||||
}
|
||||
|
||||
public void createNewNickName(String guid, String newNickname) {
|
||||
String attrJson = String.format("{\"AccountGuid\":\"%s\",\"AccountId\":\"%s\"}", guid, newNickname);
|
||||
|
||||
Map<String, AttributeValue> itemAttributes = new HashMap<>();
|
||||
itemAttributes.put("PK", AttributeValue.builder().s("user_nickname_registry#global").build());
|
||||
itemAttributes.put("SK", AttributeValue.builder().s(newNickname).build());
|
||||
itemAttributes.put("Attr", AttributeValue.builder().s(attrJson).build());
|
||||
itemAttributes.put("Type", AttributeValue.builder().s("NickName").build());
|
||||
|
||||
PutItemRequest item = PutItemRequest.builder()
|
||||
.tableName(metaTable)
|
||||
.item(itemAttributes)
|
||||
.build();
|
||||
|
||||
dynamoDbClient.putItem(item);
|
||||
|
||||
}
|
||||
public void deleteNickname(String nickname) {
|
||||
|
||||
Map<String, AttributeValue> itemAttributes = new HashMap<>();
|
||||
itemAttributes.put("PK", AttributeValue.builder().s("nickname#" + nickname).build());
|
||||
itemAttributes.put("SK", AttributeValue.builder().s("nickname#").build());
|
||||
|
||||
DeleteItemRequest request = DeleteItemRequest.builder()
|
||||
.tableName(metaTable)
|
||||
.key(itemAttributes)
|
||||
.build();
|
||||
|
||||
dynamoDbClient.deleteItem(request);
|
||||
|
||||
}
|
||||
|
||||
//신고 내역 조회
|
||||
public List<UserReportResponse.Report> getUserReportList(Map<String,String> requestParam) {
|
||||
|
||||
@@ -708,63 +589,6 @@ public class DynamoDBService {
|
||||
dynamoDbClient.updateItem(item);
|
||||
}
|
||||
|
||||
//아이템 내역 조회
|
||||
// public List<ItemList> getItems(String guid){
|
||||
// List<ItemList> list = new ArrayList<>();
|
||||
//
|
||||
// String key = "PK = :pkValue";
|
||||
// Map<String, AttributeValue> values = Map.of(":pkValue", AttributeValue.builder().s("item#"+guid).build());
|
||||
//
|
||||
//// QueryRequest queryRequest = QueryRequest.builder()
|
||||
//// .tableName(metaTable)
|
||||
//// .keyConditionExpression("PK = :pkValue") // 파티션 키와 조건식 설정
|
||||
//// .expressionAttributeValues(Map.of(":pkValue", AttributeValue.builder().s("item#"+guid).build()))
|
||||
//// .build();
|
||||
//
|
||||
// try {
|
||||
// // 쿼리 실행
|
||||
// QueryResponse response = executeQuery(key, values);
|
||||
//
|
||||
// int row = 1;
|
||||
// // 응답에서 원하는 속성을 가져옵니다.
|
||||
// for (Map<String, AttributeValue> item : response.items()) {
|
||||
// AttributeValue attrValue = item.get("ItemAttrib");
|
||||
// if (attrValue != null) {
|
||||
// // "Attr" 속성의 값을 읽어옵니다.
|
||||
// String attrJson = attrValue.s();
|
||||
//
|
||||
// // JSON 문자열을 파싱하여 Map 또는 다른 객체로 변환합니다.
|
||||
// ObjectMapper objectMapper = new ObjectMapper();
|
||||
// Map<String, Object> attrMap = objectMapper.readValue(attrJson, new TypeReference<Map<String, Object>>() {
|
||||
// });
|
||||
//
|
||||
// String item_nm = metaDataHandler.getMetaItemNameData(CommonUtils.objectToInteger(attrMap.get("item_meta_id")));
|
||||
// ItemList itemInfo = ItemList.builder()
|
||||
// .rowNum((long) row)
|
||||
// .guid(guid)
|
||||
// .itemId(attrMap.get("item_meta_id").toString())
|
||||
// .itemName(metaDataHandler.getTextStringData(item_nm))
|
||||
// .status(ItemList.STATUS.PERMITTED)
|
||||
// .restoreType("")
|
||||
// .createBy(item.get("CreatedDateTime").s()).build();
|
||||
//
|
||||
// list.add(itemInfo);
|
||||
//
|
||||
// row++;
|
||||
// }
|
||||
// }
|
||||
// log.info("getItems Response ItemInfo: {}", list);
|
||||
// }
|
||||
// catch (JsonProcessingException jpe){
|
||||
// log.error("getItems JsonProcessingException: {}", jpe.getMessage());
|
||||
// throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
||||
// }catch (Exception e){
|
||||
// log.error("getItems: {}", e.getMessage());
|
||||
// throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
||||
// }
|
||||
// return list;
|
||||
// }
|
||||
|
||||
//아이템 - 의상 조회
|
||||
public Map<String, Object> getCloth(String guid){
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
@@ -868,184 +692,25 @@ public class DynamoDBService {
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
//아이템 - 인벤토리 조회
|
||||
public UsersResponse.InventoryInfo getInvenItems(String guid){
|
||||
String key = "PK = :pkValue";
|
||||
Map<String, AttributeValue> values = Map.of(":pkValue", AttributeValue.builder().s("item#"+guid).build());
|
||||
|
||||
List<UsersResponse.Item> clothList = new ArrayList<>();
|
||||
List<UsersResponse.Item> propList = new ArrayList<>();
|
||||
List<UsersResponse.Item> beautyList = new ArrayList<>();
|
||||
List<UsersResponse.Item> tattooList = new ArrayList<>();
|
||||
List<UsersResponse.Item> currencyList = new ArrayList<>();
|
||||
List<UsersResponse.Item> etcList = new ArrayList<>();
|
||||
|
||||
try {
|
||||
excuteItems(executeQuery(key, values), "ItemAttrib")
|
||||
.filter(attrMap -> attrMap.containsKey("equiped_inven_type") && (int) attrMap.get("equiped_inven_type") == 0)
|
||||
.forEach(attrMap -> {
|
||||
int item_id = (int) attrMap.get("item_meta_id");
|
||||
String item_nm = metaDataHandler.getTextStringData(metaDataHandler.getMetaItemNameData(item_id));
|
||||
String item_type = metaDataHandler.getMetaItemLargeTypeData(item_id);
|
||||
|
||||
UsersResponse.Item inventory = UsersResponse.Item.builder()
|
||||
.itemId(item_id)
|
||||
.itemName(item_nm)
|
||||
.count(CommonUtils.objectToInteger(attrMap.get("item_stack_count")))
|
||||
.itemGuid(CommonUtils.objectToString(attrMap.get("item_guid")))
|
||||
.build();
|
||||
|
||||
if(item_type.isEmpty()) {
|
||||
etcList.add(inventory);
|
||||
}else{
|
||||
switch (ITEMLARGETYPE.valueOf(item_type)){
|
||||
case CLOTH -> clothList.add(inventory);
|
||||
case PROP -> propList.add(inventory);
|
||||
case BEAUTY -> beautyList.add(inventory);
|
||||
case TATTOO -> tattooList.add(inventory);
|
||||
case CURRENCY -> currencyList.add(inventory);
|
||||
default -> etcList.add(inventory);
|
||||
}}
|
||||
});
|
||||
|
||||
log.info("getInvenItems Response cloth: {}, prop: {}, beauty: {}, tattoo: {}, currency: {}, etc: {}", clothList, propList, beautyList, tattooList, currencyList, etcList);
|
||||
|
||||
return UsersResponse.InventoryInfo.builder()
|
||||
.cloth(clothList)
|
||||
.prop(propList)
|
||||
.beauty(beautyList)
|
||||
.tattoo(tattooList)
|
||||
.currency(currencyList)
|
||||
.etc(etcList)
|
||||
.build();
|
||||
|
||||
}catch (Exception e){
|
||||
log.error("getInvenItems: {}", e.getMessage());
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// 유저 조회 - 우편 삭제
|
||||
public String deleteMail(String type, String guid, String mail_guid) {
|
||||
Map<String, AttributeValue> itemAttributes = new HashMap<>();
|
||||
if(type.equals("SEND")){
|
||||
itemAttributes.put("PK", AttributeValue.builder().s("sent_mail#" + guid).build());
|
||||
}else{
|
||||
itemAttributes.put("PK", AttributeValue.builder().s("recv_mail#" + guid).build());
|
||||
}
|
||||
itemAttributes.put("SK", AttributeValue.builder().s(mail_guid).build());
|
||||
try {
|
||||
Map<String, AttributeValue> item = null;
|
||||
if(type.equals("SEND")){
|
||||
item = getItem("sent_mail#" + guid, mail_guid);
|
||||
log.info("deleteMail PK: {}, SK: {}", "sent_mail#" + guid, mail_guid);
|
||||
}else{
|
||||
item = getItem("recv_mail#" + guid, mail_guid);
|
||||
log.info("deleteMail PK: {}, SK: {}", "recv_mail#" + guid, mail_guid);
|
||||
}
|
||||
|
||||
DeleteItemRequest request = DeleteItemRequest.builder()
|
||||
.tableName(metaTable)
|
||||
.key(itemAttributes)
|
||||
.build();
|
||||
|
||||
DeleteItemResponse response = dynamoDbClient.deleteItem(request);
|
||||
|
||||
if(response.sdkHttpResponse().isSuccessful())
|
||||
return item.toString();
|
||||
|
||||
return "";
|
||||
}catch (ConditionalCheckFailedException e) {
|
||||
log.error("deleteUsersMail Conditional check failed: {}", e.getMessage());
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
||||
}catch(Exception e){
|
||||
log.error("deleteUsersMail: {}", e.getMessage());
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// 유저 조회 - 우편 아이템 삭제
|
||||
public JSONObject updateMailItem(String type, String guid, String mail_guid, Long itemId, double count, double newCount) {
|
||||
try {
|
||||
Map<String, AttributeValue> item = null;
|
||||
Map<String, AttributeValue> key = new HashMap<>();
|
||||
if(type.equals("SEND")){
|
||||
item = getItem("sent_mail#" + guid, mail_guid);
|
||||
key = Map.of("PK", AttributeValue.builder().s("sent_mail#" + guid).build(),"SK", AttributeValue.builder().s(mail_guid).build());
|
||||
}else{
|
||||
item = getItem("recv_mail#" + guid, mail_guid);
|
||||
key = Map.of("PK", AttributeValue.builder().s("recv_mail#" + guid).build(),"SK", AttributeValue.builder().s(mail_guid).build());
|
||||
}
|
||||
|
||||
String InfoJson = item.get("MailAttrib").s();
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
JsonNode infoNode = objectMapper.readTree(InfoJson);
|
||||
log.info("updateMailItem Before updatedInfoJson: {}", infoNode.toString());
|
||||
|
||||
ArrayNode itemListNode = (ArrayNode) infoNode.get("item_list");
|
||||
|
||||
// Java 17 스타일의 IntStream을 사용하여 itemId를 찾고 처리
|
||||
OptionalInt indexOpt = IntStream.range(0, itemListNode.size())
|
||||
.filter(i -> itemListNode.get(i).get("ItemId").asInt() == itemId)
|
||||
.findFirst();
|
||||
|
||||
if (indexOpt.isEmpty()) {
|
||||
log.error("updateMailItem mail item not found");
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
||||
}
|
||||
|
||||
int index = indexOpt.getAsInt();
|
||||
JsonNode itemNode = itemListNode.get(index);
|
||||
|
||||
if (count > newCount) {
|
||||
// count 수정
|
||||
((ObjectNode) itemNode).put("Count", count - newCount);
|
||||
} else {
|
||||
// item 삭제
|
||||
itemListNode.remove(index);
|
||||
}
|
||||
|
||||
String updatedInfoJson = infoNode.toString();
|
||||
log.info("updateMailItem Tobe updatedInfoJson: {}", updatedInfoJson);
|
||||
|
||||
Map<String, AttributeValue> expressionAttributeValues = new HashMap<>();
|
||||
expressionAttributeValues.put(":newAttrib", AttributeValue.builder().s(updatedInfoJson).build());
|
||||
|
||||
String updateExpression = "SET MailAttrib = :newAttrib";
|
||||
|
||||
UpdateItemRequest updateRequest = UpdateItemRequest.builder()
|
||||
.tableName(metaTable)
|
||||
.key(key)
|
||||
.updateExpression(updateExpression)
|
||||
.expressionAttributeValues(expressionAttributeValues)
|
||||
.returnValues(ReturnValue.ALL_NEW) // 업데이트 후의 값을 반환하려면 지정
|
||||
.build();
|
||||
|
||||
|
||||
dynamoDbClient.updateItem(updateRequest);
|
||||
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("data(before)", InfoJson);
|
||||
jsonObject.put("data(after)", updatedInfoJson);
|
||||
return jsonObject;
|
||||
}catch (ConditionalCheckFailedException e) {
|
||||
log.error("deleteUsersMail Conditional check failed: {}", e.getMessage());
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
||||
}catch(Exception e){
|
||||
log.error("deleteUsersMail: {}", e.getMessage());
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// 아이템 삭제
|
||||
// public String deleteItem(String guid, String item_guid) {
|
||||
// public String deleteMail(String type, String guid, String mail_guid) {
|
||||
// Map<String, AttributeValue> itemAttributes = new HashMap<>();
|
||||
// itemAttributes.put("PK", AttributeValue.builder().s("item#" + guid).build());
|
||||
// itemAttributes.put("SK", AttributeValue.builder().s(item_guid).build());
|
||||
// if(type.equals("SEND")){
|
||||
// itemAttributes.put("PK", AttributeValue.builder().s("sent_mail#" + guid).build());
|
||||
// }else{
|
||||
// itemAttributes.put("PK", AttributeValue.builder().s("recv_mail#" + guid).build());
|
||||
// }
|
||||
// itemAttributes.put("SK", AttributeValue.builder().s(mail_guid).build());
|
||||
// try {
|
||||
// Map<String, AttributeValue> item = getItem("item#" + guid, item_guid);
|
||||
// log.info("deleteItem PK: {}, SK: {}", "item#" + guid, item_guid);
|
||||
// Map<String, AttributeValue> item = null;
|
||||
// if(type.equals("SEND")){
|
||||
// item = getItem("sent_mail#" + guid, mail_guid);
|
||||
// log.info("deleteMail PK: {}, SK: {}", "sent_mail#" + guid, mail_guid);
|
||||
// }else{
|
||||
// item = getItem("recv_mail#" + guid, mail_guid);
|
||||
// log.info("deleteMail PK: {}, SK: {}", "recv_mail#" + guid, mail_guid);
|
||||
// }
|
||||
//
|
||||
// DeleteItemRequest request = DeleteItemRequest.builder()
|
||||
// .tableName(metaTable)
|
||||
@@ -1059,41 +724,67 @@ public class DynamoDBService {
|
||||
//
|
||||
// return "";
|
||||
// }catch (ConditionalCheckFailedException e) {
|
||||
// log.error("deleteItem Conditional check failed: {}", e.getMessage());
|
||||
// log.error("deleteUsersMail Conditional check failed: {}", e.getMessage());
|
||||
// throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
||||
// }catch(Exception e){
|
||||
// log.error("deleteItem: {}", e.getMessage());
|
||||
// log.error("deleteUsersMail: {}", e.getMessage());
|
||||
// throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
||||
// }
|
||||
// }
|
||||
|
||||
// 아이템 정보 수정
|
||||
// public JSONObject updateItem(String guid, String item_guid, int cnt) {
|
||||
// try{
|
||||
// 유저 조회 - 우편 아이템 삭제
|
||||
// public JSONObject updateMailItem(String type, String guid, String mail_guid, Long itemId, double count, double newCount) {
|
||||
// try {
|
||||
// Map<String, AttributeValue> item = null;
|
||||
// Map<String, AttributeValue> key = new HashMap<>();
|
||||
// if(type.equals("SEND")){
|
||||
// item = getItem("sent_mail#" + guid, mail_guid);
|
||||
// key = Map.of("PK", AttributeValue.builder().s("sent_mail#" + guid).build(),"SK", AttributeValue.builder().s(mail_guid).build());
|
||||
// }else{
|
||||
// item = getItem("recv_mail#" + guid, mail_guid);
|
||||
// key = Map.of("PK", AttributeValue.builder().s("recv_mail#" + guid).build(),"SK", AttributeValue.builder().s(mail_guid).build());
|
||||
// }
|
||||
//
|
||||
// Map<String, AttributeValue> item = getItem("item#" + guid, item_guid);
|
||||
//
|
||||
// String InfoJson = item.get("ItemAttrib").s();
|
||||
// String InfoJson = item.get("MailAttrib").s();
|
||||
//
|
||||
// ObjectMapper objectMapper = new ObjectMapper();
|
||||
// JsonNode infoNode = objectMapper.readTree(InfoJson);
|
||||
// log.info("updateItem Before UpdateInfo : {}", infoNode.toString());
|
||||
// log.info("updateMailItem Before updatedInfoJson: {}", infoNode.toString());
|
||||
//
|
||||
// ((ObjectNode) infoNode).put("item_stack_count", cnt);
|
||||
// ArrayNode itemListNode = (ArrayNode) infoNode.get("item_list");
|
||||
//
|
||||
// // Java 17 스타일의 IntStream을 사용하여 itemId를 찾고 처리
|
||||
// OptionalInt indexOpt = IntStream.range(0, itemListNode.size())
|
||||
// .filter(i -> itemListNode.get(i).get("ItemId").asInt() == itemId)
|
||||
// .findFirst();
|
||||
//
|
||||
// if (indexOpt.isEmpty()) {
|
||||
// log.error("updateMailItem mail item not found");
|
||||
// throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
||||
// }
|
||||
//
|
||||
// int index = indexOpt.getAsInt();
|
||||
// JsonNode itemNode = itemListNode.get(index);
|
||||
//
|
||||
// if (count > newCount) {
|
||||
// // count 수정
|
||||
// ((ObjectNode) itemNode).put("Count", count - newCount);
|
||||
// } else {
|
||||
// // item 삭제
|
||||
// itemListNode.remove(index);
|
||||
// }
|
||||
//
|
||||
// String updatedInfoJson = infoNode.toString();
|
||||
// log.info("updateItem Tobe UpdateInfo : {}", updatedInfoJson);
|
||||
// log.info("updateMailItem Tobe updatedInfoJson: {}", updatedInfoJson);
|
||||
//
|
||||
// Map<String, AttributeValue> expressionAttributeValues = new HashMap<>();
|
||||
// expressionAttributeValues.put(":newAttrib", AttributeValue.builder().s(updatedInfoJson).build());
|
||||
//
|
||||
// String updateExpression = "SET ItemAttrib = :newAttrib";
|
||||
// String updateExpression = "SET MailAttrib = :newAttrib";
|
||||
//
|
||||
// UpdateItemRequest updateRequest = UpdateItemRequest.builder()
|
||||
// .tableName(metaTable)
|
||||
// .key(Map.of(
|
||||
// "PK", AttributeValue.builder().s("item#" + guid).build(),
|
||||
// "SK", AttributeValue.builder().s(item_guid).build()))
|
||||
// .key(key)
|
||||
// .updateExpression(updateExpression)
|
||||
// .expressionAttributeValues(expressionAttributeValues)
|
||||
// .returnValues(ReturnValue.ALL_NEW) // 업데이트 후의 값을 반환하려면 지정
|
||||
@@ -1106,9 +797,12 @@ public class DynamoDBService {
|
||||
// jsonObject.put("data(before)", InfoJson);
|
||||
// jsonObject.put("data(after)", updatedInfoJson);
|
||||
// return jsonObject;
|
||||
// }catch (ConditionalCheckFailedException e) {
|
||||
// log.error("deleteUsersMail Conditional check failed: {}", e.getMessage());
|
||||
// throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
||||
// }catch(Exception e){
|
||||
// log.error("updateItem: {}", e.getMessage());
|
||||
// throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage() );
|
||||
// log.error("deleteUsersMail: {}", e.getMessage());
|
||||
// throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
@@ -5,14 +5,14 @@ import com.caliverse.admin.domain.datacomponent.MetaDataHandler;
|
||||
import com.caliverse.admin.domain.entity.*;
|
||||
import com.caliverse.admin.domain.request.EventRequest;
|
||||
import com.caliverse.admin.domain.response.EventResponse;
|
||||
import com.caliverse.admin.dynamodb.service.DynamodbMailService;
|
||||
import com.caliverse.admin.dynamodb.service.DynamodbService;
|
||||
import com.caliverse.admin.global.common.code.CommonCode;
|
||||
import com.caliverse.admin.global.common.code.ErrorCode;
|
||||
import com.caliverse.admin.global.common.code.SuccessCode;
|
||||
import com.caliverse.admin.global.common.constants.MysqlConstants;
|
||||
import com.caliverse.admin.global.common.utils.CommonUtils;
|
||||
import com.caliverse.admin.history.service.MysqlHistoryLogService;
|
||||
import com.fasterxml.jackson.databind.node.ArrayNode;
|
||||
import com.caliverse.admin.mongodb.service.MysqlHistoryLogService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.json.JSONObject;
|
||||
@@ -30,6 +30,7 @@ import java.util.Map;
|
||||
public class EventService {
|
||||
private final DynamoDBService dynamoDBService;
|
||||
private final DynamodbService dynamodbService;
|
||||
private final DynamodbMailService dynamodbMailService;
|
||||
|
||||
private final EventMapper eventMapper;
|
||||
private final MetaDataHandler metaDataHandler;
|
||||
@@ -120,23 +121,12 @@ public class EventService {
|
||||
Event event = eventMapper.getEventDetail(event_id);
|
||||
|
||||
mysqlHistoryLogService.insertHistoryLog(
|
||||
HISTORYTYPE.EVENT_ADD,
|
||||
HISTORYTYPEDETAIL.EVENT_ADD,
|
||||
MysqlConstants.TABLE_NAME_EVENT,
|
||||
HISTORYTYPE.EVENT_ADD.name(),
|
||||
event,
|
||||
CommonUtils.getAdmin().getEmail(),
|
||||
CommonUtils.getClientIp()
|
||||
HISTORYTYPEDETAIL.EVENT_ADD.name(),
|
||||
event
|
||||
);
|
||||
|
||||
|
||||
//로그 기록
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("type",eventRequest.getEventType());
|
||||
jsonObject.put("start_dt",eventRequest.getStartDt());
|
||||
jsonObject.put("end_dt",eventRequest.getEndDt());
|
||||
jsonObject.put("mail_list",map);
|
||||
historyService.setLog(HISTORYTYPE.EVENT_ADD, jsonObject);
|
||||
|
||||
return EventResponse.builder()
|
||||
.status(CommonCode.SUCCESS.getHttpStatus())
|
||||
.result(CommonCode.SUCCESS.getResult())
|
||||
@@ -197,61 +187,13 @@ public class EventService {
|
||||
after_event.setItemList(eventMapper.getItem(event_id));
|
||||
|
||||
mysqlHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPE.EVENT_UPDATE,
|
||||
HISTORYTYPEDETAIL.EVENT_UPDATE,
|
||||
MysqlConstants.TABLE_NAME_EVENT,
|
||||
HISTORYTYPE.EVENT_UPDATE.name(),
|
||||
HISTORYTYPEDETAIL.EVENT_UPDATE.name(),
|
||||
before_info,
|
||||
after_event,
|
||||
CommonUtils.getAdmin().getEmail(),
|
||||
CommonUtils.getClientIp()
|
||||
after_event
|
||||
);
|
||||
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
// if(result == 1){
|
||||
// ObjectMapper objectMapper = new ObjectMapper();
|
||||
// ArrayNode mailTitleArray = objectMapper.createArrayNode();
|
||||
// ArrayNode mailTextArray = objectMapper.createArrayNode();
|
||||
// ArrayNode mailItemArray = objectMapper.createArrayNode();
|
||||
// for(Item item : eventRequest.getItemList()){
|
||||
// MailItem mailItem = MailItem.newBuilder().setItemId(CommonUtils.stringToInt(item.getItem())).setCount(item.getItemCnt()).build();
|
||||
// mailItemArray.add(JsonUtils.createMAilItem(mailItem));
|
||||
// }
|
||||
// for(Message msg: eventRequest.getMailList()){
|
||||
// String langText = msg.getLanguage();
|
||||
// int lang;
|
||||
//
|
||||
// if(langText.equals(LANGUAGETYPE.EN.toString())){
|
||||
// lang = LanguageType.LanguageType_en.getNumber();
|
||||
// }else if(langText.equals(LANGUAGETYPE.JA.toString())){
|
||||
// lang = LanguageType.LanguageType_ja.getNumber();
|
||||
// }else{
|
||||
// lang = LanguageType.LanguageType_ko.getNumber();
|
||||
// }
|
||||
// SystemMessage titleMessage = SystemMessage.builder().LanguageType(lang).Text(msg.getTitle()).build();
|
||||
// SystemMessage textMessage = SystemMessage.builder().LanguageType(lang).Text(msg.getContent()).build();
|
||||
//
|
||||
// mailTitleArray.add(JsonUtils.createSystemMessage(titleMessage));
|
||||
// mailTextArray.add(JsonUtils.createSystemMessage(textMessage));
|
||||
// }
|
||||
//
|
||||
// String dynamoResult = dynamoDBService.updateSystemMail(
|
||||
// event_id.toString(),
|
||||
// mailTitleArray,
|
||||
// mailTextArray,
|
||||
// eventRequest.getStartDt(),
|
||||
// eventRequest.getEndDt(),
|
||||
// mailItemArray);
|
||||
// jsonObject.put("dynamoDB_update",dynamoResult);
|
||||
// log.info("updateEvent DynamoDB Update Complete: {}", dynamoResult);
|
||||
// }
|
||||
|
||||
//로그 기록
|
||||
jsonObject.put("before_event",before_info.toString());
|
||||
jsonObject.put("type",eventRequest.getEventType());
|
||||
jsonObject.put("start_dt",eventRequest.getStartDt());
|
||||
jsonObject.put("end_dt",eventRequest.getEndDt());
|
||||
historyService.setLog(HISTORYTYPE.EVENT_UPDATE, jsonObject);
|
||||
|
||||
return EventResponse.builder()
|
||||
.status(CommonCode.SUCCESS.getHttpStatus())
|
||||
.result(CommonCode.SUCCESS.getResult())
|
||||
@@ -278,27 +220,11 @@ public class EventService {
|
||||
log.info("updateEvent AdminTool Delete Complete: {}", eventRequest);
|
||||
|
||||
mysqlHistoryLogService.deleteHistoryLog(
|
||||
HISTORYTYPE.EVENT_DELETE,
|
||||
HISTORYTYPEDETAIL.EVENT_DELETE,
|
||||
MysqlConstants.TABLE_NAME_EVENT,
|
||||
HISTORYTYPE.EVENT_DELETE.name(),
|
||||
event,
|
||||
CommonUtils.getAdmin().getEmail(),
|
||||
CommonUtils.getClientIp()
|
||||
HISTORYTYPEDETAIL.EVENT_DELETE.name(),
|
||||
event
|
||||
);
|
||||
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
// if(result == 1){
|
||||
// String dynamoResult = dynamoDBService.deleteSystemMail(item.getId().toString());
|
||||
// jsonObject.put("dynamoDB_data",dynamoResult);
|
||||
// log.info("updateEvent dynamoDB Delete Complete: {}", dynamoResult);
|
||||
// }
|
||||
|
||||
//로그 기록
|
||||
List<Message> message = eventMapper.getMessage(item.getId());
|
||||
if(!message.isEmpty()){
|
||||
jsonObject.put("message",message.get(0).getTitle());
|
||||
}
|
||||
historyService.setLog(HISTORYTYPE.EVENT_DELETE, jsonObject);
|
||||
}
|
||||
);
|
||||
|
||||
@@ -365,7 +291,7 @@ public class EventService {
|
||||
event.setMailList(eventMapper.getMessage(event_id));
|
||||
event.setItemList(eventMapper.getItem(event_id));
|
||||
|
||||
dynamodbService.insertSystemMail(event);
|
||||
dynamodbMailService.insertSystemMail(event);
|
||||
|
||||
eventMapper.updateAddFlag(event_id);
|
||||
updateEventStatus(event_id, Event.EVENTSTATUS.RUNNING);
|
||||
|
||||
@@ -85,7 +85,7 @@ public class GroupService {
|
||||
|
||||
//권한 그룹 등록
|
||||
public GroupResponse postAdminGroup(GroupRequest groupRequest){
|
||||
List<Integer> authList = Arrays.asList(1, 5, 6, 9, 10, 11, 13, 14, 15, 16, 19, 22, 24, 26, 32); //그룹 초기 권한
|
||||
List<Integer> authList = Arrays.asList(1, 5, 6, 9, 10, 11, 13, 14, 15, 16, 19, 22, 24, 26, 32, 36, 41,46, 49); //그룹 초기 권한
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
groupRequest.setCreateBy(CommonUtils.getAdmin().getId());
|
||||
|
||||
@@ -137,7 +137,7 @@ public class GroupService {
|
||||
map.put("adminId", CommonUtils.getAdmin().getId());
|
||||
map.put("name", CommonUtils.getAdmin().getName());
|
||||
map.put("mail", CommonUtils.getAdmin().getEmail());
|
||||
map.put("type", HISTORYTYPE.GROUP_AUTH_UPDATE);
|
||||
map.put("type", HISTORYTYPEDETAIL.GROUP_AUTH_UPDATE);
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("groupNm",groupMapper.getGroupInfo(Long.valueOf(groupId)).get("name"));
|
||||
jsonObject.put("auth(before)",beforeAuth);
|
||||
@@ -168,7 +168,7 @@ public class GroupService {
|
||||
map.put("adminId", CommonUtils.getAdmin().getId());
|
||||
map.put("name", CommonUtils.getAdmin().getName());
|
||||
map.put("mail", CommonUtils.getAdmin().getEmail());
|
||||
map.put("type", HISTORYTYPE.GROUP_DELETE);
|
||||
map.put("type", HISTORYTYPEDETAIL.GROUP_DELETE);
|
||||
map.put("content",jsonObject.toString());
|
||||
historyMapper.saveLog(map);
|
||||
}
|
||||
|
||||
@@ -1,13 +1,18 @@
|
||||
package com.caliverse.admin.domain.service;
|
||||
|
||||
import com.caliverse.admin.domain.entity.HISTORYTYPE;
|
||||
import com.caliverse.admin.domain.entity.Log;
|
||||
import com.caliverse.admin.domain.dao.admin.AdminMapper;
|
||||
import com.caliverse.admin.domain.entity.Admin;
|
||||
import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
|
||||
import com.caliverse.admin.domain.dao.admin.HistoryMapper;
|
||||
import com.caliverse.admin.domain.request.HistoryRequest;
|
||||
import com.caliverse.admin.domain.response.HistoryResponse;
|
||||
import com.caliverse.admin.global.common.code.CommonCode;
|
||||
import com.caliverse.admin.global.common.code.ErrorCode;
|
||||
import com.caliverse.admin.global.common.utils.CommonUtils;
|
||||
|
||||
import io.jsonwebtoken.io.IOException;
|
||||
import com.caliverse.admin.global.common.utils.DateUtils;
|
||||
import com.caliverse.admin.mongodb.domain.HistoryLogInfoBase;
|
||||
import com.caliverse.admin.mongodb.service.HistoryLogService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -15,42 +20,84 @@ import org.apache.commons.io.FileUtils;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class HistoryService {
|
||||
|
||||
private final AdminMapper adminMapper;
|
||||
private final HistoryMapper historyMapper;
|
||||
private final HistoryLogService historyLogService;
|
||||
|
||||
public HistoryResponse getHistoryList(Map requestParams){
|
||||
|
||||
//페이징 처리
|
||||
requestParams = CommonUtils.pageSetting(requestParams);
|
||||
String searchType = requestParams.get("searchType").toString();
|
||||
String searchData = requestParams.get("searchData").toString();
|
||||
HISTORYTYPEDETAIL historyType = requestParams.get("historyType").equals("") ? null : HISTORYTYPEDETAIL.valueOf(requestParams.get("historyType").toString());
|
||||
LocalDateTime startDt = requestParams.get("startDate").equals("") ? null : DateUtils.stringISOToLocalDateTime(requestParams.get("startDate").toString());
|
||||
LocalDateTime endDt = requestParams.get("endDate").equals("") ? null : DateUtils.stringISOToLocalDateTime(requestParams.get("endDate").toString());
|
||||
|
||||
List<Log> historyList = historyMapper.getHistoryList(requestParams);
|
||||
// List<Log> historyList = historyMapper.getHistoryList(requestParams);
|
||||
|
||||
HistoryRequest historyRequest = new HistoryRequest();
|
||||
historyRequest.setHistoryType(historyType);
|
||||
historyRequest.setStartDt(startDt);
|
||||
historyRequest.setEndDt(endDt);
|
||||
if(searchType.equals("NAME")){
|
||||
Optional<Admin> admin = adminMapper.findByEmail(searchData);
|
||||
if(admin.isPresent()){
|
||||
historyRequest.setUserMail(searchData);
|
||||
}else{
|
||||
return HistoryResponse.builder()
|
||||
.resultData(HistoryResponse.ResultData.builder()
|
||||
.message(ErrorCode.NOT_USER.toString())
|
||||
.build())
|
||||
.status(CommonCode.ERROR.getHttpStatus())
|
||||
.result(CommonCode.ERROR.getResult())
|
||||
.build();
|
||||
}
|
||||
}else{
|
||||
historyRequest.setUserMail(searchData);
|
||||
}
|
||||
|
||||
List<HistoryLogInfoBase> historyList = historyLogService.loadHistoryData(historyRequest, HistoryLogInfoBase.class);
|
||||
|
||||
int allCnt = historyMapper.getAllCnt(requestParams);
|
||||
|
||||
return HistoryResponse.builder()
|
||||
.resultData(HistoryResponse.ResultData.builder()
|
||||
.total(historyMapper.getTotal())
|
||||
.totalAll(allCnt)
|
||||
.pageNo(requestParams.get("page_no")!=null?
|
||||
Integer.valueOf(requestParams.get("page_no").toString()):1)
|
||||
.list(historyList).build())
|
||||
.list(historyList)
|
||||
.build())
|
||||
.status(CommonCode.SUCCESS.getHttpStatus())
|
||||
.result(CommonCode.SUCCESS.getResult())
|
||||
.build();
|
||||
}
|
||||
|
||||
public HistoryResponse getHistory(HistoryRequest historyRequest){
|
||||
|
||||
List<HistoryLogInfoBase> historyList = historyLogService.loadHistoryData(historyRequest, HistoryLogInfoBase.class);
|
||||
|
||||
return HistoryResponse.builder()
|
||||
.resultData(HistoryResponse.ResultData.builder()
|
||||
.list(historyList)
|
||||
.build())
|
||||
.status(CommonCode.SUCCESS.getHttpStatus())
|
||||
.result(CommonCode.SUCCESS.getResult())
|
||||
.build();
|
||||
}
|
||||
|
||||
public HistoryResponse getHistoryDetail(String id){
|
||||
String logJson = historyMapper.getLogJson(id);
|
||||
return HistoryResponse.builder()
|
||||
@@ -60,58 +107,7 @@ public class HistoryService {
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void insertMetaData(File file) {
|
||||
try {
|
||||
// Read the JSON data from the file
|
||||
String jsonData = FileUtils.readFileToString(file, StandardCharsets.UTF_8);
|
||||
|
||||
// Parse the JSON data into a JSONArray
|
||||
JSONArray jsonArray = new JSONArray(jsonData);
|
||||
|
||||
|
||||
// Iterate over the elements in the JSONArray
|
||||
for (int i = 0; i < jsonArray.length(); i++) {
|
||||
// Get the current element as a JSONObject
|
||||
JSONObject jsonObject = jsonArray.getJSONObject(i);
|
||||
|
||||
// Extract the values from the JSONObject
|
||||
Integer itemId = Integer.valueOf(jsonObject.getInt("item_id"));
|
||||
|
||||
|
||||
Map<String, Object> item = new HashMap<>();
|
||||
item.put("fileName", file.getName());
|
||||
item.put("dataId", itemId);
|
||||
item.put("jsonData", jsonObject.toString());
|
||||
|
||||
|
||||
// Insert the values into MariaDB
|
||||
|
||||
historyMapper.insertMetaData(item);
|
||||
|
||||
|
||||
|
||||
}
|
||||
} catch (java.io.IOException e) {
|
||||
log.error("insertMetaData IOException: {}", e.getMessage());
|
||||
} catch (JSONException e) {
|
||||
log.error("insertMetaData JSONException: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void setLog(HISTORYTYPE type, JSONObject content){
|
||||
//로그 기록
|
||||
Map<String, Object> logMap = new HashMap<>();
|
||||
logMap.put("adminId", CommonUtils.getAdmin().getId());
|
||||
logMap.put("name", CommonUtils.getAdmin().getName());
|
||||
logMap.put("mail", CommonUtils.getAdmin().getEmail());
|
||||
logMap.put("type", type);
|
||||
logMap.put("content",content.toString());
|
||||
historyMapper.saveLog(logMap);
|
||||
}
|
||||
|
||||
public void setScheduleLog(HISTORYTYPE type, String message){
|
||||
public void setScheduleLog(HISTORYTYPEDETAIL type, String message){
|
||||
//스케줄 로그 기록
|
||||
Map<String, Object> logMap = new HashMap<>();
|
||||
logMap.put("adminId", 1);
|
||||
|
||||
@@ -68,7 +68,7 @@ public class ItemsService {
|
||||
ItemsResponse.Item item = ItemsResponse.Item.builder()
|
||||
.userGuid(finalGuid)
|
||||
.itemGuid(attrib.getItemGuid())
|
||||
.id(itemId)
|
||||
.id(attrib.getItemGuid())
|
||||
.itemId(itemId)
|
||||
.itemName(metaDataHandler.getTextStringData(metaDataHandler.getMetaItemNameData(itemId)))
|
||||
.count(attrib.getItemStackCount())
|
||||
|
||||
@@ -23,7 +23,7 @@ import com.caliverse.admin.global.common.constants.CommonConstants;
|
||||
import com.caliverse.admin.global.common.constants.MysqlConstants;
|
||||
import com.caliverse.admin.global.common.utils.CommonUtils;
|
||||
import com.caliverse.admin.global.common.utils.DateUtils;
|
||||
import com.caliverse.admin.history.service.MysqlHistoryLogService;
|
||||
import com.caliverse.admin.mongodb.service.MysqlHistoryLogService;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -417,12 +417,10 @@ public class LandService {
|
||||
auction_info.setMessageList(landMapper.getMessage(auction_id));
|
||||
|
||||
mysqlHistoryLogService.insertHistoryLog(
|
||||
HISTORYTYPE.LAND_AUCTION_ADD,
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_ADD,
|
||||
MysqlConstants.TABLE_NAME_LAND_AUCTION,
|
||||
HISTORYTYPE.LAND_AUCTION_ADD.name(),
|
||||
auction_info,
|
||||
CommonUtils.getAdmin().getEmail(),
|
||||
CommonUtils.getClientIp()
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_ADD.name(),
|
||||
auction_info
|
||||
);
|
||||
|
||||
dynamodbLandAuctionService.insertLandAuctionRegistryWithActivity(landRequest);
|
||||
@@ -485,12 +483,10 @@ public class LandService {
|
||||
LandOwnerChange info = landMapper.getLandOwnerChangeDetail(id);
|
||||
|
||||
mysqlHistoryLogService.insertHistoryLog(
|
||||
HISTORYTYPE.LAND_OWNER_CHANGE_ADD,
|
||||
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_ADD,
|
||||
MysqlConstants.TABLE_NAME_LAND_OWNER_CHANGE,
|
||||
HISTORYTYPE.LAND_OWNER_CHANGE_ADD.name(),
|
||||
info,
|
||||
CommonUtils.getAdmin().getEmail(),
|
||||
CommonUtils.getClientIp()
|
||||
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_ADD.name(),
|
||||
info
|
||||
);
|
||||
|
||||
// if(!is_reserve){
|
||||
@@ -547,16 +543,14 @@ public class LandService {
|
||||
// log.info("AdminToolDB Message Update Complete");
|
||||
|
||||
LandAuction after_info = landMapper.getLandAuctionDetail(id);
|
||||
after_info.setMessageList(landMapper.getMessage(id));
|
||||
// after_info.setMessageList(landMapper.getMessage(id));
|
||||
|
||||
mysqlHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPE.LAND_AUCTION_UPDATE,
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_UPDATE,
|
||||
MysqlConstants.TABLE_NAME_LAND_AUCTION,
|
||||
HISTORYTYPE.LAND_AUCTION_UPDATE.name(),
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_UPDATE.name(),
|
||||
before_info,
|
||||
after_info,
|
||||
CommonUtils.getAdmin().getEmail(),
|
||||
CommonUtils.getClientIp()
|
||||
after_info
|
||||
);
|
||||
|
||||
dynamodbLandAuctionService.updateLandAuction(landRequest);
|
||||
@@ -587,13 +581,11 @@ public class LandService {
|
||||
LandOwnerChange after_info = landMapper.getLandOwnerChangeDetail(id);
|
||||
|
||||
mysqlHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPE.LAND_OWNER_CHANGE_UPDATE,
|
||||
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_UPDATE,
|
||||
MysqlConstants.TABLE_NAME_LAND_OWNER_CHANGE,
|
||||
HISTORYTYPE.LAND_OWNER_CHANGE_UPDATE.name(),
|
||||
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_UPDATE.name(),
|
||||
before_info,
|
||||
after_info,
|
||||
CommonUtils.getAdmin().getEmail(),
|
||||
CommonUtils.getClientIp()
|
||||
after_info
|
||||
);
|
||||
|
||||
dynamodbLandService.ChangesLandOwner(landRequest);
|
||||
@@ -628,26 +620,13 @@ public class LandService {
|
||||
log.info("LandAuction Delete Complete: {}", item);
|
||||
|
||||
mysqlHistoryLogService.deleteHistoryLog(
|
||||
HISTORYTYPE.LAND_AUCTION_DELETE,
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_DELETE,
|
||||
MysqlConstants.TABLE_NAME_LAND_AUCTION,
|
||||
HISTORYTYPE.LAND_AUCTION_DELETE.name(),
|
||||
auction_info,
|
||||
CommonUtils.getAdmin().getEmail(),
|
||||
CommonUtils.getClientIp()
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_DELETE.name(),
|
||||
auction_info
|
||||
);
|
||||
|
||||
dynamodbLandAuctionService.cancelLandAuction(auction_info);
|
||||
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
|
||||
//로그 기록
|
||||
List<Message> message = landMapper.getMessage(item.getId());
|
||||
if(!message.isEmpty()){
|
||||
jsonObject.put("message",message.get(0).getTitle());
|
||||
}
|
||||
jsonObject.put("auction_info", auction_info);
|
||||
// jsonObject.put("dynamoDB_result",land_auction_registry_result);
|
||||
historyService.setLog(HISTORYTYPE.LAND_AUCTION_DELETE, jsonObject);
|
||||
}
|
||||
);
|
||||
|
||||
@@ -686,12 +665,10 @@ public class LandService {
|
||||
log.info("LandOwnerChanges Delete Complete: {}", landRequest);
|
||||
|
||||
mysqlHistoryLogService.deleteHistoryLog(
|
||||
HISTORYTYPE.LAND_OWNER_CHANGE_DELETE,
|
||||
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_DELETE,
|
||||
MysqlConstants.TABLE_NAME_LAND_OWNER_CHANGE,
|
||||
HISTORYTYPE.LAND_OWNER_CHANGE_DELETE.name(),
|
||||
info,
|
||||
CommonUtils.getAdmin().getEmail(),
|
||||
CommonUtils.getClientIp()
|
||||
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_DELETE.name(),
|
||||
info
|
||||
);
|
||||
|
||||
return LandResponse.builder()
|
||||
|
||||
@@ -1,35 +1,16 @@
|
||||
package com.caliverse.admin.domain.service;
|
||||
|
||||
import com.caliverse.admin.Indicators.Indicatorsservice.aggregationservice.*;
|
||||
import com.caliverse.admin.Indicators.entity.*;
|
||||
import com.caliverse.admin.domain.entity.Currencys;
|
||||
import com.caliverse.admin.domain.entity.LandInfo;
|
||||
import com.caliverse.admin.domain.entity.ROUTE;
|
||||
import com.caliverse.admin.domain.request.LogGenericRequest;
|
||||
import com.caliverse.admin.domain.response.IndicatorsResponse;
|
||||
import com.caliverse.admin.domain.response.LandResponse;
|
||||
import com.caliverse.admin.domain.response.LogResponse;
|
||||
import com.caliverse.admin.global.common.code.CommonCode;
|
||||
import com.caliverse.admin.global.common.code.ErrorCode;
|
||||
import com.caliverse.admin.global.common.exception.RestApiException;
|
||||
import com.caliverse.admin.global.common.utils.CommonUtils;
|
||||
import com.caliverse.admin.global.common.utils.ExcelUtils;
|
||||
import com.caliverse.admin.logs.Indicatordomain.GenericMongoLog;
|
||||
import com.caliverse.admin.logs.logservice.businesslogservice.BusinessLogGenericService;
|
||||
import com.caliverse.admin.logs.logservice.indicators.IndicatorsDauService;
|
||||
import com.caliverse.admin.logs.logservice.indicators.IndicatorsMcuService;
|
||||
import com.caliverse.admin.logs.logservice.indicators.IndicatorsNruService;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.mongodb.MongoCommandException;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.data.mongodb.UncategorizedMongoDbException;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -51,6 +32,11 @@ public class LogService {
|
||||
// logGenericRequest.setEndDt(endDt);
|
||||
|
||||
// List<Map<String, Object>> logList = businessLogGenericService.loadBusinessLogData(logGenericRequest);
|
||||
LocalDateTime startDt = logGenericRequest.getStartDt().plusHours(9);
|
||||
LocalDateTime endDt = logGenericRequest.getEndDt().plusHours(9).plusDays(1);
|
||||
logGenericRequest.setStartDt(startDt);
|
||||
logGenericRequest.setEndDt(endDt);
|
||||
|
||||
List<GenericMongoLog> logList = new ArrayList<>();
|
||||
try{
|
||||
logList = businessLogGenericService.loadBusinessLogData(logGenericRequest, GenericMongoLog.class);
|
||||
@@ -61,7 +47,13 @@ public class LogService {
|
||||
.status(CommonCode.ERROR.getHttpStatus())
|
||||
.result(ErrorCode.ERROR_LOG_MEMORY_LIMIT.toString())
|
||||
.build();
|
||||
} else {
|
||||
} else if (e.getMessage().contains("time limit")) {
|
||||
log.error("MongoDB Query operation exceeded time limit: {}", e.getMessage());
|
||||
return LogResponse.builder()
|
||||
.status(CommonCode.ERROR.getHttpStatus())
|
||||
.result(ErrorCode.ERROR_LOG_MEMORY_LIMIT.toString())
|
||||
.build();
|
||||
}else {
|
||||
log.error("MongoDB Query error", e);
|
||||
return LogResponse.builder()
|
||||
.status(CommonCode.ERROR.getHttpStatus())
|
||||
@@ -72,6 +64,19 @@ public class LogService {
|
||||
log.error("businessLog error", e);
|
||||
}
|
||||
|
||||
logList = logList.stream().map(logData -> {
|
||||
try {
|
||||
var header = logData.getMessage().get("Header");
|
||||
var body = logData.getMessage().get("Body");
|
||||
logData.setHeader((Map<String, Object>) header);
|
||||
logData.setBody((Map<String, Object>) body);
|
||||
return logData;
|
||||
} catch (Exception e) {
|
||||
log.error("Error parsing JSON from message field", e);
|
||||
return logData;
|
||||
}
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
int totalItems = logList.size();
|
||||
|
||||
return LogResponse.builder()
|
||||
|
||||
@@ -13,13 +13,14 @@ import com.caliverse.admin.global.common.code.CommonCode;
|
||||
import com.caliverse.admin.global.common.code.ErrorCode;
|
||||
import com.caliverse.admin.global.common.code.SuccessCode;
|
||||
import com.caliverse.admin.global.common.constants.CommonConstants;
|
||||
import com.caliverse.admin.global.common.constants.MysqlConstants;
|
||||
import com.caliverse.admin.global.common.exception.RestApiException;
|
||||
import com.caliverse.admin.global.common.utils.CommonUtils;
|
||||
import com.caliverse.admin.global.common.utils.ExcelUtils;
|
||||
import com.caliverse.admin.mongodb.service.MysqlHistoryLogService;
|
||||
import com.caliverse.admin.scheduler.ScheduleService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.json.JSONObject;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.core.io.UrlResource;
|
||||
@@ -53,6 +54,7 @@ public class MailService {
|
||||
private final ScheduleService scheduleService;
|
||||
private final HistoryService historyService;
|
||||
private final DynamodbCaliumService dynamodbCaliumService;
|
||||
private final MysqlHistoryLogService mysqlHistoryLogService;
|
||||
|
||||
public MailResponse getStockCalium(){
|
||||
double stock_calium = dynamodbCaliumService.getCaliumTotal();
|
||||
@@ -153,7 +155,7 @@ public class MailService {
|
||||
public Resource excelDown(String fileName) {
|
||||
Path filePath = Path.of(excelPath+fileName);
|
||||
try {
|
||||
if(fileName.contains("sample")){
|
||||
if(fileName.contains("_sample")){
|
||||
return resourceLoader.getResource(samplePath + fileName);
|
||||
}
|
||||
Resource resource = new UrlResource(filePath.toUri());
|
||||
@@ -180,16 +182,15 @@ public class MailService {
|
||||
|
||||
//단일일경우 guid 를 target 설정, 복수이면은 fileName을 target에 설정
|
||||
if(mailRequest.getGuid() != null){
|
||||
if(mailRequest.getUserType().equals(Mail.USERTYPE.GUID) && dynamoDBService.isGuidChecked(mailRequest.getGuid())){
|
||||
if(mailRequest.getUserType().equals(Mail.USERTYPE.GUID) && !dynamodbUserService.isUser(mailRequest.getGuid())){
|
||||
log.error("postMail RECEIVETYPE Single Guid Find Fail");
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.WARNING_GUID_CHECK.getMessage());
|
||||
}
|
||||
String guid = mailRequest.getGuid();
|
||||
// 닉네임이면 guid로 바꾼다
|
||||
if(mailRequest.getUserType().equals(Mail.USERTYPE.NICKNAME)) {
|
||||
// guid = dynamoDBService.getNickNameByGuid(guid);
|
||||
guid = getGuid(guid, Mail.USERTYPE.NICKNAME.name());
|
||||
if(guid == null || mailRequest.getGuid().equals(guid)){
|
||||
if(guid == null || guid.isEmpty() || mailRequest.getGuid().equals(guid)){
|
||||
log.error("postMail RECEIVETYPE Single Nickname Find Fail");
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.NICKNAME_CHECK.getMessage() );
|
||||
}
|
||||
@@ -213,7 +214,7 @@ public class MailService {
|
||||
for(Excel excel : excelList){
|
||||
switch (excel.getType()) {
|
||||
case "GUID" -> {
|
||||
if (dynamoDBService.isGuidChecked(excel.getUser())) {
|
||||
if (!dynamodbUserService.isUser(excel.getUser())) {
|
||||
log.error("postMail Multi Guid({}) Find Fail", excel.getUser());
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.WARNING_GUID_CHECK.toString());
|
||||
}
|
||||
@@ -241,7 +242,6 @@ public class MailService {
|
||||
|
||||
mailMapper.postMail(mailRequest);
|
||||
|
||||
//log.info("mail_id::"+ mailRequest.getId());
|
||||
HashMap<String,String> map = new HashMap<>();
|
||||
map.put("mailId",String.valueOf(mailRequest.getId()));
|
||||
|
||||
@@ -289,16 +289,16 @@ public class MailService {
|
||||
}
|
||||
log.info("postMail Insert Mail: {}", mailRequest);
|
||||
|
||||
//로그 기록
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("mail_type",mailRequest.getMailType());
|
||||
jsonObject.put("receiver",mailRequest.getTarget());
|
||||
Mail.SENDTYPE sendType = mailRequest.getSendType();
|
||||
jsonObject.put("send_type",sendType);
|
||||
if(sendType.equals(Mail.SENDTYPE.RESERVE_SEND))
|
||||
jsonObject.put("send_dt",mailRequest.getSendDt());
|
||||
jsonObject.put("mail_list",map);
|
||||
historyService.setLog(HISTORYTYPE.MAIL_ADD, jsonObject);
|
||||
Mail info = mailMapper.getMailDetail(mailRequest.getId());
|
||||
info.setMailList(mailMapper.getMessage(mailRequest.getId()));
|
||||
info.setItemList(mailMapper.getItem(mailRequest.getId()));
|
||||
|
||||
mysqlHistoryLogService.insertHistoryLog(
|
||||
HISTORYTYPEDETAIL.MAIL_ADD,
|
||||
MysqlConstants.TABLE_NAME_MAIL,
|
||||
HISTORYTYPEDETAIL.MAIL_ADD.name(),
|
||||
info
|
||||
);
|
||||
|
||||
return MailResponse.builder()
|
||||
.status(CommonCode.SUCCESS.getHttpStatus())
|
||||
@@ -339,10 +339,10 @@ public class MailService {
|
||||
|
||||
Long mail_id = mailRequest.getId();
|
||||
Mail before_info = mailMapper.getMailDetail(mail_id);
|
||||
List<Message> before_msg = mailMapper.getMessage(mail_id);
|
||||
List<Item> before_item = mailMapper.getItem(mail_id);
|
||||
before_info.setMailList(mailMapper.getMessage(mail_id));
|
||||
before_info.setItemList(mailMapper.getItem(mail_id));
|
||||
|
||||
log.info("updateMail Update Before MailInfo: {}, Message: {}, Item: {}", before_info, before_msg, before_item);
|
||||
log.info("updateMail Update Before MailInfo: {}", before_info);
|
||||
|
||||
mailMapper.updateMail(mailRequest);
|
||||
|
||||
@@ -380,18 +380,28 @@ public class MailService {
|
||||
}
|
||||
log.info("updateMail Update After Mail: {}", mailRequest);
|
||||
|
||||
Mail after_info = mailMapper.getMailDetail(mail_id);
|
||||
after_info.setMailList(mailMapper.getMessage(mail_id));
|
||||
after_info.setItemList(mailMapper.getItem(mail_id));
|
||||
|
||||
mysqlHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPEDETAIL.MAIL_UPDATE,
|
||||
MysqlConstants.TABLE_NAME_MAIL,
|
||||
HISTORYTYPEDETAIL.MAIL_UPDATE.name(),
|
||||
before_info,
|
||||
after_info
|
||||
);
|
||||
|
||||
//로그 기록
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("before_info",before_info.toString());
|
||||
jsonObject.put("before_msg",before_msg.toString());
|
||||
jsonObject.put("before_item",before_item.toString());
|
||||
jsonObject.put("mail_type",mailRequest.getMailType());
|
||||
jsonObject.put("receiver",mailRequest.getTarget());
|
||||
Mail.SENDTYPE sendType = mailRequest.getSendType();
|
||||
jsonObject.put("send_type",sendType);
|
||||
if(sendType.equals(Mail.SENDTYPE.RESERVE_SEND))
|
||||
jsonObject.put("send_dt",mailRequest.getSendDt());
|
||||
historyService.setLog(HISTORYTYPE.MAIL_UPDATE, jsonObject);
|
||||
// JSONObject jsonObject = new JSONObject();
|
||||
// jsonObject.put("before_info",before_info.toString());
|
||||
// jsonObject.put("mail_type",mailRequest.getMailType());
|
||||
// jsonObject.put("receiver",mailRequest.getTarget());
|
||||
// Mail.SENDTYPE sendType = mailRequest.getSendType();
|
||||
// jsonObject.put("send_type",sendType);
|
||||
// if(sendType.equals(Mail.SENDTYPE.RESERVE_SEND))
|
||||
// jsonObject.put("send_dt",mailRequest.getSendDt());
|
||||
// historyService.setLog(HISTORYTYPE.MAIL_UPDATE, jsonObject);
|
||||
|
||||
return MailResponse.builder()
|
||||
.status(CommonCode.SUCCESS.getHttpStatus())
|
||||
@@ -408,25 +418,36 @@ public class MailService {
|
||||
|
||||
mailRequest.getList().forEach(
|
||||
item->{
|
||||
map.put("id",item.getId());
|
||||
long id = item.getId();
|
||||
|
||||
Mail info = mailMapper.getMailDetail(id);
|
||||
|
||||
map.put("id",id);
|
||||
mailMapper.deleteMail(map);
|
||||
|
||||
// 스케줄에서 제거
|
||||
scheduleService.closeTask("mail-" + item.getId());
|
||||
log.info("deleteMail Mail: {}", item);
|
||||
|
||||
mysqlHistoryLogService.deleteHistoryLog(
|
||||
HISTORYTYPEDETAIL.MAIL_DELETE,
|
||||
MysqlConstants.TABLE_NAME_MAIL,
|
||||
HISTORYTYPEDETAIL.MAIL_DELETE.name(),
|
||||
info
|
||||
);
|
||||
|
||||
//로그 기록
|
||||
List<Message> message = mailMapper.getMessage(Long.valueOf(item.getId()));
|
||||
map.put("adminId", CommonUtils.getAdmin().getId());
|
||||
map.put("name", CommonUtils.getAdmin().getName());
|
||||
map.put("mail", CommonUtils.getAdmin().getEmail());
|
||||
map.put("type", HISTORYTYPE.MAIL_DELETE);
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
if(!message.isEmpty()){
|
||||
jsonObject.put("message",message.get(0).getTitle());
|
||||
}
|
||||
map.put("content",jsonObject.toString());
|
||||
historyMapper.saveLog(map);
|
||||
// List<Message> message = mailMapper.getMessage(Long.valueOf(item.getId()));
|
||||
// map.put("adminId", CommonUtils.getAdmin().getId());
|
||||
// map.put("name", CommonUtils.getAdmin().getName());
|
||||
// map.put("mail", CommonUtils.getAdmin().getEmail());
|
||||
// map.put("type", HISTORYTYPE.MAIL_DELETE);
|
||||
// JSONObject jsonObject = new JSONObject();
|
||||
// if(!message.isEmpty()){
|
||||
// jsonObject.put("message",message.get(0).getTitle());
|
||||
// }
|
||||
// map.put("content",jsonObject.toString());
|
||||
// historyMapper.saveLog(map);
|
||||
}
|
||||
);
|
||||
|
||||
@@ -495,7 +516,7 @@ public class MailService {
|
||||
return target;
|
||||
}
|
||||
|
||||
public void setScheduleLog(HISTORYTYPE type, String message){
|
||||
public void setScheduleLog(HISTORYTYPEDETAIL type, String message){
|
||||
//스케줄 로그 기록
|
||||
historyService.setScheduleLog(type, message);
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import com.caliverse.admin.global.common.constants.MysqlConstants;
|
||||
import com.caliverse.admin.global.common.exception.RestApiException;
|
||||
import com.caliverse.admin.global.common.utils.CommonUtils;
|
||||
import com.caliverse.admin.global.common.utils.FileUtils;
|
||||
import com.caliverse.admin.history.service.MysqlHistoryLogService;
|
||||
import com.caliverse.admin.mongodb.service.MysqlHistoryLogService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
@@ -198,12 +198,10 @@ public class MenuService {
|
||||
MenuBanner banner = menuMapper.getBannerDetail(menuRequest.getId());
|
||||
|
||||
mysqlHistoryLogService.insertHistoryLog(
|
||||
HISTORYTYPE.MENU_BANNER_ADD,
|
||||
HISTORYTYPEDETAIL.MENU_BANNER_ADD,
|
||||
MysqlConstants.TABLE_NAME_MENU_BANNER,
|
||||
HISTORYTYPE.MENU_BANNER_ADD.name(),
|
||||
banner,
|
||||
CommonUtils.getAdmin().getEmail(),
|
||||
CommonUtils.getClientIp()
|
||||
HISTORYTYPEDETAIL.MENU_BANNER_ADD.name(),
|
||||
banner
|
||||
);
|
||||
|
||||
return MenuResponse.builder()
|
||||
@@ -252,13 +250,11 @@ public class MenuService {
|
||||
after_info.setImageList(menuMapper.getMessage(banner_id));
|
||||
|
||||
mysqlHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPE.MENU_BANNER_UPDATE,
|
||||
HISTORYTYPEDETAIL.MENU_BANNER_UPDATE,
|
||||
MysqlConstants.TABLE_NAME_MENU_BANNER,
|
||||
HISTORYTYPE.MENU_BANNER_UPDATE.name(),
|
||||
HISTORYTYPEDETAIL.MENU_BANNER_UPDATE.name(),
|
||||
before_info,
|
||||
after_info,
|
||||
CommonUtils.getAdmin().getEmail(),
|
||||
CommonUtils.getClientIp()
|
||||
after_info
|
||||
);
|
||||
|
||||
return MenuResponse.builder()
|
||||
|
||||
@@ -2,14 +2,16 @@ package com.caliverse.admin.domain.service;
|
||||
|
||||
import com.caliverse.admin.domain.dao.admin.HistoryMapper;
|
||||
import com.caliverse.admin.domain.dao.admin.NoticeMapper;
|
||||
import com.caliverse.admin.domain.entity.HISTORYTYPE;
|
||||
import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
|
||||
import com.caliverse.admin.domain.entity.InGame;
|
||||
import com.caliverse.admin.domain.entity.Message;
|
||||
import com.caliverse.admin.domain.request.NoticeRequest;
|
||||
import com.caliverse.admin.domain.response.NoticeResponse;
|
||||
import com.caliverse.admin.global.common.code.CommonCode;
|
||||
import com.caliverse.admin.global.common.code.SuccessCode;
|
||||
import com.caliverse.admin.global.common.constants.MysqlConstants;
|
||||
import com.caliverse.admin.global.common.utils.CommonUtils;
|
||||
import com.caliverse.admin.mongodb.service.MysqlHistoryLogService;
|
||||
import com.caliverse.admin.scheduler.ScheduleService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -31,6 +33,7 @@ public class NoticeService {
|
||||
private final HistoryMapper historyMapper;
|
||||
private final ScheduleService scheduleService;
|
||||
private final HistoryService historyService;
|
||||
private final MysqlHistoryLogService mysqlHistoryLogService;
|
||||
|
||||
public NoticeResponse getNoticeList(){
|
||||
|
||||
@@ -95,16 +98,13 @@ public class NoticeService {
|
||||
}
|
||||
log.info("postInGameMessage notice: {}", noticeRequest);
|
||||
|
||||
//로그 기록
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("message_type",noticeRequest.getMessageType());
|
||||
jsonObject.put("repeat_type",noticeRequest.getRepeatType());
|
||||
jsonObject.put("repeat_cnt",noticeRequest.getRepeatCnt());
|
||||
jsonObject.put("repeat_dt",noticeRequest.getRepeatDt());
|
||||
jsonObject.put("send_dt",noticeRequest.getSendDt());
|
||||
jsonObject.put("end_dt",noticeRequest.getEndDt());
|
||||
jsonObject.put("message",noticeRequest.getGameMessages().toString());
|
||||
historyService.setLog(HISTORYTYPE.NOTICE_ADD, jsonObject);
|
||||
mysqlHistoryLogService.insertHistoryLog(
|
||||
HISTORYTYPEDETAIL.NOTICE_ADD,
|
||||
MysqlConstants.TABLE_NAME_NOTICE,
|
||||
HISTORYTYPEDETAIL.NOTICE_ADD.name(),
|
||||
noticeMapper.getNoticeDetail(noticeRequest.getId())
|
||||
);
|
||||
|
||||
|
||||
return NoticeResponse.builder()
|
||||
.resultData(NoticeResponse.ResultData.builder().message(SuccessCode.REGISTRATION.getMessage()).build())
|
||||
@@ -117,6 +117,9 @@ public class NoticeService {
|
||||
public NoticeResponse updateInGameMessage(Long id, NoticeRequest noticeRequest){
|
||||
noticeRequest.setId(id);
|
||||
noticeRequest.setUpdateBy(CommonUtils.getAdmin().getId());
|
||||
|
||||
InGame before_info = noticeMapper.getNoticeDetail(id);
|
||||
|
||||
int i = noticeMapper.updateNotice(noticeRequest);
|
||||
// 스케줄에서 기존 등록 제거
|
||||
scheduleService.closeTask(noticeRequest.getId().toString());
|
||||
@@ -144,6 +147,14 @@ public class NoticeService {
|
||||
}
|
||||
}
|
||||
log.info("updateInGameMessage After notice: {}", noticeRequest);
|
||||
|
||||
mysqlHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPEDETAIL.NOTICE_UPDATE,
|
||||
MysqlConstants.TABLE_NAME_NOTICE,
|
||||
HISTORYTYPEDETAIL.NOTICE_UPDATE.name(),
|
||||
before_info,
|
||||
noticeMapper.getNoticeDetail(id)
|
||||
);
|
||||
return NoticeResponse.builder()
|
||||
.resultData(NoticeResponse.ResultData.builder().message(SuccessCode.UPDATE.getMessage()).build())
|
||||
.result(CommonCode.SUCCESS.getResult())
|
||||
@@ -168,15 +179,13 @@ public class NoticeService {
|
||||
|
||||
log.info("deleteInGameMessage notice: {}", item);
|
||||
|
||||
//로그 기록
|
||||
map.put("adminId", CommonUtils.getAdmin().getId());
|
||||
map.put("name", CommonUtils.getAdmin().getName());
|
||||
map.put("mail", CommonUtils.getAdmin().getEmail());
|
||||
map.put("type", HISTORYTYPE.NOTICE_DELETE);
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("message",message);
|
||||
map.put("content",jsonObject.toString());
|
||||
historyMapper.saveLog(map);
|
||||
mysqlHistoryLogService.deleteHistoryLog(
|
||||
HISTORYTYPEDETAIL.NOTICE_DELETE,
|
||||
MysqlConstants.TABLE_NAME_NOTICE,
|
||||
HISTORYTYPEDETAIL.NOTICE_DELETE.name(),
|
||||
noticeMapper.getNoticeDetail(item.getMessageId())
|
||||
);
|
||||
|
||||
}
|
||||
);
|
||||
log.info("deleteInGameMessage notice: {}", noticeRequest);
|
||||
@@ -206,7 +215,7 @@ public class NoticeService {
|
||||
noticeMapper.updateCountNotice(id);
|
||||
}
|
||||
|
||||
public void setScheduleLog(HISTORYTYPE type, String message){
|
||||
public void setScheduleLog(HISTORYTYPEDETAIL type, String message){
|
||||
//스케줄 로그 기록
|
||||
Map<String, Object> logMap = new HashMap<>();
|
||||
logMap.put("adminId", 1);
|
||||
|
||||
@@ -8,7 +8,6 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.caliverse.admin.domain.entity.FriendRequest;
|
||||
import com.caliverse.admin.domain.entity.HISTORYTYPE;
|
||||
import com.caliverse.admin.domain.entity.SEARCHTYPE;
|
||||
import com.caliverse.admin.domain.request.MailRequest;
|
||||
import com.caliverse.admin.dynamodb.domain.atrrib.AccountBaseAttrib;
|
||||
@@ -18,17 +17,14 @@ import com.caliverse.admin.dynamodb.domain.atrrib.MoneyAttrib;
|
||||
import com.caliverse.admin.dynamodb.domain.doc.MailDoc;
|
||||
import com.caliverse.admin.dynamodb.dto.PageResult;
|
||||
import com.caliverse.admin.dynamodb.service.DynamodbItemService;
|
||||
import com.caliverse.admin.dynamodb.service.DynamodbMailService;
|
||||
import com.caliverse.admin.dynamodb.service.DynamodbService;
|
||||
import com.caliverse.admin.dynamodb.service.DynamodbUserService;
|
||||
import com.caliverse.admin.global.common.utils.DynamodbUtil;
|
||||
import com.caliverse.admin.redis.service.RedisUserInfoService;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.json.JSONObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.caliverse.admin.domain.datacomponent.MetaDataHandler;
|
||||
@@ -55,8 +51,8 @@ public class UsersService {
|
||||
private final RedisUserInfoService redisUserInfoService;
|
||||
private final DynamodbUserService dynamodbUserService;
|
||||
private final DynamodbItemService dynamodbItemService;
|
||||
private final DynamodbMailService dynamodbMailService;
|
||||
|
||||
//metadataHandler 어떻게 가져와야 되는가
|
||||
@Autowired
|
||||
private MetaDataHandler metaDataHandler;
|
||||
|
||||
@@ -69,17 +65,11 @@ public class UsersService {
|
||||
//신규 닉네임 유효성 체크
|
||||
ErrorCode check = CommonUtils.isValidNickname(newNickname);
|
||||
if(!check.equals(ErrorCode.SUCCESS)){
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), check.getMessage() );
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), check.toString() );
|
||||
}
|
||||
|
||||
String isGuid = dynamodbUserService.getNameByGuid(newNickname);
|
||||
|
||||
if(!isGuid.isEmpty()){
|
||||
//변경 닉네임이 존재합니다. 다시 시도해주세요.
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.NICKNAME_EXIT_ERROR.getMessage() );
|
||||
}else{
|
||||
dynamoDBService.updateNickname(guid,nickname,newNickname);
|
||||
}
|
||||
userGameSessionService.kickUserSession(guid, String.format("%s User Nickname Changes", nickname));
|
||||
dynamodbUserService.changesNickname(guid, nickname, newNickname);
|
||||
|
||||
return UsersResponse.builder()
|
||||
.resultData(UsersResponse.ResultData.builder()
|
||||
@@ -133,14 +123,23 @@ public class UsersService {
|
||||
// Map<String,String> res = dynamoDBService.findUsersBykey(searchType, searchKey);
|
||||
Map<String,String> resultMap = new HashMap<>();
|
||||
if(searchType.equals(SEARCHTYPE.NAME.name())){
|
||||
resultMap.put("guid", dynamodbUserService.getNameByGuid(searchKey.toLowerCase())); //nickname은 무조건 소문자
|
||||
resultMap.put("nickname", searchKey);
|
||||
String name_guid = dynamodbUserService.getNameByGuid(searchKey.toLowerCase());
|
||||
if(!name_guid.isEmpty()){
|
||||
resultMap.put("guid", name_guid); //nickname은 무조건 소문자
|
||||
resultMap.put("nickname", searchKey);
|
||||
}
|
||||
}else if(searchType.equals(SEARCHTYPE.GUID.name())){
|
||||
resultMap.put("guid", searchKey);
|
||||
resultMap.put("nickname", dynamodbUserService.getGuidByName(searchKey));
|
||||
String guid_name = dynamodbUserService.getGuidByName(searchKey);
|
||||
if(!guid_name.isEmpty()){
|
||||
resultMap.put("guid", searchKey);
|
||||
resultMap.put("nickname", guid_name);
|
||||
}
|
||||
}else if(searchType.equals(SEARCHTYPE.ACCOUNT.name())){
|
||||
resultMap.put("guid", dynamodbUserService.getAccountIdByGuid(searchKey));
|
||||
resultMap.put("nickname", dynamodbUserService.getAccountIdByName(searchKey));
|
||||
String account_guid = dynamodbUserService.getAccountIdByGuid(searchKey);
|
||||
if(!account_guid.isEmpty()){
|
||||
resultMap.put("guid", account_guid);
|
||||
resultMap.put("nickname", dynamodbUserService.getAccountIdByName(searchKey));
|
||||
}
|
||||
}
|
||||
|
||||
return UsersResponse.builder()
|
||||
@@ -152,6 +151,7 @@ public class UsersService {
|
||||
.build();
|
||||
}
|
||||
|
||||
//유저 기본 정보
|
||||
public UsersResponse getBasicInfo(String guid){
|
||||
|
||||
String account_id = dynamodbUserService.getGuidByAccountId(guid);
|
||||
@@ -198,6 +198,7 @@ public class UsersService {
|
||||
|
||||
}
|
||||
|
||||
//아바타 정보
|
||||
public UsersResponse getAvatarInfo(String guid){
|
||||
|
||||
//avatarInfo
|
||||
@@ -215,10 +216,8 @@ public class UsersService {
|
||||
|
||||
}
|
||||
|
||||
//의상 정보
|
||||
public UsersResponse getClothInfo(String guid){
|
||||
|
||||
//clothInfo
|
||||
// Map<String, Object> charInfo = dynamoDBService.getClothInfo(guid);
|
||||
Map<String, Object> charInfo = dynamoDBService.getCloth(guid);
|
||||
|
||||
return UsersResponse.builder()
|
||||
@@ -233,10 +232,8 @@ public class UsersService {
|
||||
|
||||
}
|
||||
|
||||
//도구 정보
|
||||
public UsersResponse getToolSlotInfo(String guid){
|
||||
|
||||
// toolslotInfo
|
||||
// List<UsersResponse.SlotInfo> toolSlot = dynamoDBService.getToolSlot(guid);
|
||||
Map<String, Object> toolSlot = dynamoDBService.getTools(guid);
|
||||
|
||||
return UsersResponse.builder()
|
||||
@@ -250,33 +247,9 @@ public class UsersService {
|
||||
.build();
|
||||
|
||||
}
|
||||
public UsersResponse getInventoryInfo(String guid){
|
||||
|
||||
// List<List<UsersResponse.Inventory>> inventoryList = new ArrayList<>();
|
||||
// List<List<String>> item = dynamoDBService.getInvenItems(guid);
|
||||
// if(item != null){
|
||||
// for (List<String> list : item){
|
||||
// List<UsersResponse.Inventory> innerList = new ArrayList<>();
|
||||
// for (String key : list){
|
||||
// Map<String, Object> resItem = dynamoDBService.getItemTable(key);
|
||||
//
|
||||
// //객체를 생성하고 값을 설정
|
||||
// UsersResponse.Inventory inventory = new UsersResponse.Inventory();
|
||||
//
|
||||
// Object itemId = resItem.get("ItemId");
|
||||
// String itemIdString = CommonUtils.objectToString(itemId);
|
||||
// Integer itemIdInteger = CommonUtils.objectToInteger(itemId);
|
||||
//
|
||||
//
|
||||
// inventory.setCount(Integer.valueOf(CommonUtils.objectToString(resItem.get("Count"))));
|
||||
// inventory.setItemId(itemIdString);
|
||||
// inventory.setItemName(metaDataHandler.getMetaItemData(itemIdInteger).getName());
|
||||
// innerList.add(inventory);
|
||||
// }
|
||||
// inventoryList.add(innerList);
|
||||
// }
|
||||
// }
|
||||
// UsersResponse.InventoryInfo inventoryInfo = dynamoDBService.getInvenItems(guid);
|
||||
//인벤토리 정보
|
||||
public UsersResponse getInventoryInfo(String guid){
|
||||
UsersResponse.InventoryInfo inventoryInfo = dynamodbItemService.getInvenItems(guid);
|
||||
logger.info("getInventoryInfo Inventory Items: {}", inventoryInfo);
|
||||
|
||||
@@ -292,6 +265,7 @@ public class UsersService {
|
||||
|
||||
}
|
||||
|
||||
//인벤토리 아이템 삭제
|
||||
public UsersResponse deleteInventoryItem(Map<String, String> requestParams){
|
||||
String guid = requestParams.get("guid");
|
||||
String item_guid = requestParams.get("item_guid");
|
||||
@@ -300,12 +274,6 @@ public class UsersService {
|
||||
|
||||
userGameSessionService.kickUserSession(guid, "Item delete");
|
||||
if(update_cnt >= current_cnt){
|
||||
// String attrib = dynamoDBService.deleteItem(guid, item_guid);
|
||||
// if(!attrib.isEmpty()){
|
||||
// JSONObject jsonObject = new JSONObject();
|
||||
// jsonObject.put("data",attrib);
|
||||
// historyService.setLog(HISTORYTYPE.INVENTORY_ITEM_DELETE, jsonObject);
|
||||
// }
|
||||
dynamodbItemService.deleteItem(guid, item_guid);
|
||||
return UsersResponse.builder()
|
||||
.status(CommonCode.SUCCESS.getHttpStatus())
|
||||
@@ -317,10 +285,6 @@ public class UsersService {
|
||||
}else{
|
||||
int cnt = current_cnt - update_cnt;
|
||||
dynamodbItemService.updateItemStack(guid, item_guid, cnt);
|
||||
// JSONObject json = dynamoDBService.updateItem(guid, item_guid, cnt);
|
||||
// if(!json.isEmpty()){
|
||||
// historyService.setLog(HISTORYTYPE.INVENTORY_ITEM_UPDATE, json);
|
||||
// }
|
||||
return UsersResponse.builder()
|
||||
.status(CommonCode.SUCCESS.getHttpStatus())
|
||||
.result(CommonCode.SUCCESS.getResult())
|
||||
@@ -331,18 +295,17 @@ public class UsersService {
|
||||
}
|
||||
}
|
||||
|
||||
//우편 정보
|
||||
public UsersResponse getMail(UsersRequest usersRequest){
|
||||
// List<UsersResponse.Mail> mailList = dynamoDBService.getMail(guid, type);
|
||||
PageResult<MailDoc> mailPageResult = dynamodbService.getMail(usersRequest.getMailType(), usersRequest.getGuid(), "", usersRequest.getPageKey());
|
||||
PageResult<MailDoc> mailPageResult = dynamodbMailService.getMail(usersRequest.getMailType(), usersRequest.getGuid(), "", usersRequest.getPageKey());
|
||||
List<UsersResponse.Mail> mailList = new ArrayList<>();
|
||||
|
||||
mailPageResult.getItems().forEach(doc -> {
|
||||
try {
|
||||
// MailAttrib attrib = objectMapper.readValue(doc.getAttribValue(), MailAttrib.class);
|
||||
MailAttrib attrib = doc.getAttribValue();
|
||||
List<UsersResponse.MailItem> itemList = new ArrayList<>();
|
||||
if(attrib == null){
|
||||
MailJsonAttrib mailJsonAttrib = dynamodbService.getMailJsonAttrib(doc.getPK(),doc.getSK());
|
||||
MailJsonAttrib mailJsonAttrib = dynamodbMailService.getMailJsonAttrib(doc.getPK(),doc.getSK());
|
||||
mailJsonAttrib.getItemList().forEach(item -> {
|
||||
UsersResponse.MailItem mailItem = new UsersResponse.MailItem();
|
||||
mailItem.setItemId(CommonUtils.objectToString(item.getItemId()));
|
||||
@@ -414,18 +377,14 @@ public class UsersService {
|
||||
|
||||
}
|
||||
|
||||
//우편 삭제
|
||||
public UsersResponse deleteMail(Map<String, String> requestParams){
|
||||
String guid = requestParams.get("guid");
|
||||
String mail_guid = requestParams.get("mail_guid");
|
||||
String type = requestParams.get("type");
|
||||
|
||||
userGameSessionService.kickUserSession(guid, "delete mail");
|
||||
String attrib = dynamoDBService.deleteMail(type, guid, mail_guid);
|
||||
if(!attrib.isEmpty()){
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("data",attrib);
|
||||
historyService.setLog(HISTORYTYPE.USER_MAIL_DELETE, jsonObject);
|
||||
}
|
||||
dynamodbMailService.deleteMail(type, guid, mail_guid);
|
||||
|
||||
return UsersResponse.builder()
|
||||
.status(CommonCode.SUCCESS.getHttpStatus())
|
||||
@@ -436,13 +395,12 @@ public class UsersService {
|
||||
.build();
|
||||
}
|
||||
|
||||
//우편 아이템 삭제
|
||||
public UsersResponse deleteMailItem(MailRequest.DeleteMailItem deleteMailItem){
|
||||
userGameSessionService.kickUserSession(deleteMailItem.getGuid(), "delete mail item");
|
||||
JSONObject json = dynamoDBService.updateMailItem(deleteMailItem.getType(), deleteMailItem.getGuid(),
|
||||
dynamodbMailService.deleteMailItem(deleteMailItem.getType(), deleteMailItem.getGuid(),
|
||||
deleteMailItem.getMailGuid(), deleteMailItem.getItemId(), deleteMailItem.getParrentCount(), deleteMailItem.getCount());
|
||||
if(!json.isEmpty()){
|
||||
historyService.setLog(HISTORYTYPE.MAIL_ITEM_UPDATE, json);
|
||||
}
|
||||
|
||||
return UsersResponse.builder()
|
||||
.status(CommonCode.SUCCESS.getHttpStatus())
|
||||
.result(CommonCode.SUCCESS.getResult())
|
||||
@@ -452,6 +410,7 @@ public class UsersService {
|
||||
.build();
|
||||
}
|
||||
|
||||
//마이홈 정보
|
||||
public UsersResponse getMyhome(String guid){
|
||||
|
||||
UsersResponse.Myhome myhome = dynamoDBService.getMyhome(guid);
|
||||
@@ -468,6 +427,7 @@ public class UsersService {
|
||||
|
||||
}
|
||||
|
||||
//친구 목록
|
||||
public UsersResponse getFriendList(String guid){
|
||||
|
||||
List<UsersResponse.Friend> friendList = dynamoDBService.getFriendList(guid);
|
||||
@@ -516,6 +476,7 @@ public class UsersService {
|
||||
.build();
|
||||
}
|
||||
|
||||
//타투 정보
|
||||
public UsersResponse getTattoo(String guid){
|
||||
List<UsersResponse.Tattoo> resTatto = dynamoDBService.getTattoo(guid);
|
||||
|
||||
@@ -531,29 +492,8 @@ public class UsersService {
|
||||
|
||||
}
|
||||
|
||||
//퀘스트 정보
|
||||
public UsersResponse getQuest(String guid){
|
||||
// UsersResponse.Quest quest = new UsersResponse.Quest();
|
||||
//
|
||||
// List<UsersResponse.Quest> questListQuest = new ArrayList<>();
|
||||
//
|
||||
// Map<String, List<Map<String, Object>>> resMap= dynamoDBService.getQuest(guid);
|
||||
//
|
||||
// //List<Map<String, Object>> endList = resMap.get("EndList");
|
||||
// List<Map<String, Object>> questList = resMap.get("QuestList");
|
||||
//
|
||||
// int index = 1;
|
||||
// if(questList != null){
|
||||
// for (Map<String,Object> val : questList){
|
||||
// if(val != null){
|
||||
// quest = new UsersResponse.Quest();
|
||||
// quest.setQuestId(Integer.valueOf(CommonUtils.objectToString(val.get("QuestId"))));
|
||||
// quest.setStatus(CommonUtils.objectToString(val.get("IsComplete")));
|
||||
// quest.setRowNum((long)index);
|
||||
// questListQuest.add(quest);
|
||||
// index++;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
List<UsersResponse.QuestInfo> questList = dynamoDBService.getQuest(guid);
|
||||
|
||||
@@ -568,20 +508,5 @@ public class UsersService {
|
||||
.build();
|
||||
|
||||
}
|
||||
/*public UsersResponse getClaim(String guid){
|
||||
|
||||
List<UsersResponse.Guid> tattoo = dynamoDBService.getTattoo(guid);
|
||||
|
||||
return UsersResponse.builder()
|
||||
.resultData(
|
||||
UsersResponse.ResultData.builder()
|
||||
.tattooList(tattoo)
|
||||
.build()
|
||||
)
|
||||
.status(CommonCode.SUCCESS.getHttpStatus())
|
||||
.result(CommonCode.SUCCESS.getResult())
|
||||
.build();
|
||||
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
@@ -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.ErrorCode;
|
||||
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.databind.ObjectMapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@@ -1,28 +1,20 @@
|
||||
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.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.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.repository.AccountBaseRepository;
|
||||
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.global.common.code.CommonCode;
|
||||
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.exception.RestApiException;
|
||||
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.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -31,8 +23,6 @@ import software.amazon.awssdk.enhanced.dynamodb.Key;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
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));
|
||||
|
||||
dynamodbHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPE.BLACKLIST_UPDATE,
|
||||
HISTORYTYPE.BLACKLIST_UPDATE.name(),
|
||||
HISTORYTYPEDETAIL.BLACKLIST_UPDATE,
|
||||
HISTORYTYPEDETAIL.BLACKLIST_UPDATE.name(),
|
||||
beforeDoc,
|
||||
afterDoc
|
||||
);
|
||||
@@ -131,8 +121,8 @@ public class AccountBaseRepositoryImpl extends BaseDynamoDBRepository<AccountBas
|
||||
log.info("updateBlockUserEnd Update Success: {}", objectMapper.writeValueAsString(afterDoc));
|
||||
|
||||
dynamodbHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPE.BLACKLIST_UPDATE,
|
||||
HISTORYTYPE.BLACKLIST_UPDATE.name(),
|
||||
HISTORYTYPEDETAIL.BLACKLIST_UPDATE,
|
||||
HISTORYTYPEDETAIL.BLACKLIST_UPDATE.name(),
|
||||
beforeDoc,
|
||||
afterDoc
|
||||
);
|
||||
@@ -166,8 +156,8 @@ public class AccountBaseRepositoryImpl extends BaseDynamoDBRepository<AccountBas
|
||||
log.info("updateAdminLevel Update Success: {}", objectMapper.writeValueAsString(afterDoc));
|
||||
|
||||
dynamodbHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPE.USER_ADMIN_AUTH_UPDATE,
|
||||
HISTORYTYPE.USER_ADMIN_AUTH_UPDATE.name(),
|
||||
HISTORYTYPEDETAIL.USER_ADMIN_AUTH_UPDATE,
|
||||
HISTORYTYPEDETAIL.USER_ADMIN_AUTH_UPDATE.name(),
|
||||
beforeDoc,
|
||||
afterDoc
|
||||
);
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
package com.caliverse.admin.dynamodb.repository.Impl;
|
||||
|
||||
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.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.LandAuctionRegistryDoc;
|
||||
import com.caliverse.admin.dynamodb.entity.EDayOfWeekType;
|
||||
import com.caliverse.admin.dynamodb.entity.EOncePeriodRangeType;
|
||||
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.exception.RestApiException;
|
||||
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 lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -117,8 +115,8 @@ public class BattleEventRepositoryImpl extends BaseDynamoDBRepository<BattleEven
|
||||
save(doc);
|
||||
|
||||
dynamodbHistoryLogService.insertHistoryLog(
|
||||
HISTORYTYPE.BATTLE_EVENT_ADD,
|
||||
HISTORYTYPE.BATTLE_EVENT_ADD.name(),
|
||||
HISTORYTYPEDETAIL.BATTLE_EVENT_ADD,
|
||||
HISTORYTYPEDETAIL.BATTLE_EVENT_ADD.name(),
|
||||
doc
|
||||
);
|
||||
}catch (Exception e){
|
||||
@@ -162,8 +160,8 @@ public class BattleEventRepositoryImpl extends BaseDynamoDBRepository<BattleEven
|
||||
log.info("BattleEventDoc Update Success: {}", objectMapper.writeValueAsString(afterDoc));
|
||||
|
||||
dynamodbHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPE.BATTLE_EVENT_UPDATE,
|
||||
HISTORYTYPE.BATTLE_EVENT_UPDATE.name(),
|
||||
HISTORYTYPEDETAIL.BATTLE_EVENT_UPDATE,
|
||||
HISTORYTYPEDETAIL.BATTLE_EVENT_UPDATE.name(),
|
||||
beforeDoc,
|
||||
afterDoc
|
||||
);
|
||||
@@ -202,8 +200,8 @@ public class BattleEventRepositoryImpl extends BaseDynamoDBRepository<BattleEven
|
||||
log.info("BattleEventDoc Update Stop Success: {}", objectMapper.writeValueAsString(afterDoc));
|
||||
|
||||
dynamodbHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPE.BATTLE_EVENT_UPDATE,
|
||||
HISTORYTYPE.BATTLE_EVENT_UPDATE.name(),
|
||||
HISTORYTYPEDETAIL.BATTLE_EVENT_UPDATE,
|
||||
HISTORYTYPEDETAIL.BATTLE_EVENT_UPDATE.name(),
|
||||
beforeDoc,
|
||||
afterDoc
|
||||
);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
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.dynamodb.domain.atrrib.BuildingAttrib;
|
||||
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.exception.RestApiException;
|
||||
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 lombok.extern.slf4j.Slf4j;
|
||||
@@ -86,8 +86,8 @@ public class BuildingRepositoryImpl extends BaseDynamoDBRepository<BuildingDoc>
|
||||
log.info("BuildingDoc Insert Success: {}", objectMapper.writeValueAsString(doc));
|
||||
|
||||
dynamodbHistoryLogService.insertHistoryLog(
|
||||
HISTORYTYPE.LAND_OWNER_CHANGE_ADD,
|
||||
HISTORYTYPE.LAND_OWNER_CHANGE_ADD.name(),
|
||||
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_ADD,
|
||||
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_ADD.name(),
|
||||
doc
|
||||
);
|
||||
|
||||
@@ -127,8 +127,8 @@ public class BuildingRepositoryImpl extends BaseDynamoDBRepository<BuildingDoc>
|
||||
log.info("BuildingDoc Update Success: {}", objectMapper.writeValueAsString(afterDoc));
|
||||
|
||||
dynamodbHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPE.LAND_OWNER_CHANGE_UPDATE,
|
||||
HISTORYTYPE.LAND_OWNER_CHANGE_UPDATE.name(),
|
||||
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_UPDATE,
|
||||
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_UPDATE.name(),
|
||||
beforeDoc,
|
||||
afterDoc
|
||||
);
|
||||
@@ -163,8 +163,8 @@ public class BuildingRepositoryImpl extends BaseDynamoDBRepository<BuildingDoc>
|
||||
log.info("BuildingDoc Owned Init Update Success: {}", objectMapper.writeValueAsString(afterDoc));
|
||||
|
||||
dynamodbHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPE.LAND_OWNED_INITIALIZE,
|
||||
HISTORYTYPE.LAND_OWNED_INITIALIZE.name(),
|
||||
HISTORYTYPEDETAIL.LAND_OWNED_INITIALIZE,
|
||||
HISTORYTYPEDETAIL.LAND_OWNED_INITIALIZE.name(),
|
||||
beforeDoc,
|
||||
afterDoc
|
||||
);
|
||||
@@ -206,8 +206,8 @@ public class BuildingRepositoryImpl extends BaseDynamoDBRepository<BuildingDoc>
|
||||
log.info("BuildingDoc Desc Init Update Success: {}", objectMapper.writeValueAsString(afterDoc));
|
||||
|
||||
dynamodbHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPE.LAND_DESC_INITIALIZE,
|
||||
HISTORYTYPE.LAND_DESC_INITIALIZE.name(),
|
||||
HISTORYTYPEDETAIL.LAND_DESC_INITIALIZE,
|
||||
HISTORYTYPEDETAIL.LAND_DESC_INITIALIZE.name(),
|
||||
beforeDoc,
|
||||
afterDoc
|
||||
);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
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.doc.CaliumStorageDoc;
|
||||
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.exception.RestApiException;
|
||||
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 lombok.extern.slf4j.Slf4j;
|
||||
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));
|
||||
|
||||
dynamodbHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPE.CALIUM_TOTAL_UPDATE,
|
||||
HISTORYTYPE.CALIUM_TOTAL_UPDATE.name(),
|
||||
HISTORYTYPEDETAIL.CALIUM_TOTAL_UPDATE,
|
||||
HISTORYTYPEDETAIL.CALIUM_TOTAL_UPDATE.name(),
|
||||
beforeDoc,
|
||||
afterDoc
|
||||
);
|
||||
@@ -131,8 +131,8 @@ public class CaliumStorageRepositoryImpl extends BaseDynamoDBRepository<CaliumSt
|
||||
log.info("CaliumStorageDoc Calium Total Update Success: {}", objectMapper.writeValueAsString(afterDoc));
|
||||
|
||||
dynamodbHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPE.CALIUM_TOTAL_UPDATE,
|
||||
HISTORYTYPE.CALIUM_TOTAL_UPDATE.name(),
|
||||
HISTORYTYPEDETAIL.CALIUM_TOTAL_UPDATE,
|
||||
HISTORYTYPEDETAIL.CALIUM_TOTAL_UPDATE.name(),
|
||||
beforeDoc,
|
||||
afterDoc
|
||||
);
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
package com.caliverse.admin.dynamodb.repository.Impl;
|
||||
|
||||
import com.caliverse.admin.domain.entity.EFilterOperator;
|
||||
import com.caliverse.admin.domain.entity.HISTORYTYPE;
|
||||
import com.caliverse.admin.domain.entity.SEARCHTYPE;
|
||||
import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
|
||||
import com.caliverse.admin.dynamodb.domain.atrrib.ItemAttrib;
|
||||
import com.caliverse.admin.dynamodb.domain.atrrib.LandAuctionRegistryAttrib;
|
||||
import com.caliverse.admin.dynamodb.domain.doc.ItemDoc;
|
||||
import com.caliverse.admin.dynamodb.domain.doc.LandAuctionRegistryDoc;
|
||||
import com.caliverse.admin.dynamodb.dto.PageResult;
|
||||
import com.caliverse.admin.dynamodb.repository.BaseDynamoDBRepository;
|
||||
import com.caliverse.admin.dynamodb.repository.ItemRepository;
|
||||
@@ -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.exception.RestApiException;
|
||||
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 lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -82,8 +79,8 @@ public class ItemRepositoryImpl extends BaseDynamoDBRepository<ItemDoc> implemen
|
||||
log.info("updateItemStack Update Success: {}", CommonUtils.objectByString(afterDoc));
|
||||
|
||||
dynamodbHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPE.ITEM_UPDATE,
|
||||
HISTORYTYPE.ITEM_UPDATE.name(),
|
||||
HISTORYTYPEDETAIL.ITEM_UPDATE,
|
||||
HISTORYTYPEDETAIL.ITEM_UPDATE.name(),
|
||||
beforeDoc,
|
||||
afterDoc
|
||||
);
|
||||
@@ -110,8 +107,8 @@ public class ItemRepositoryImpl extends BaseDynamoDBRepository<ItemDoc> implemen
|
||||
log.info("ItemDoc Delete Success: {}", CommonUtils.objectByString(beforeDoc));
|
||||
|
||||
dynamodbHistoryLogService.deleteHistoryLog(
|
||||
HISTORYTYPE.ITEM_DELETE,
|
||||
HISTORYTYPE.ITEM_DELETE.name(),
|
||||
HISTORYTYPEDETAIL.ITEM_DELETE,
|
||||
HISTORYTYPEDETAIL.ITEM_DELETE.name(),
|
||||
beforeDoc
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
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.dynamodb.domain.atrrib.LandAuctionActivityAttrib;
|
||||
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.repository.BaseDynamoDBRepository;
|
||||
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.exception.RestApiException;
|
||||
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 lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import software.amazon.awssdk.enhanced.dynamodb.Key;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
@@ -75,8 +73,8 @@ public class LandAuctionActivityRepositoryImpl extends BaseDynamoDBRepository<La
|
||||
log.info("LandAuctionActivityDoc Delete Success: {}", objectMapper.writeValueAsString(doc));
|
||||
|
||||
dynamodbHistoryLogService.deleteHistoryLog(
|
||||
HISTORYTYPE.LAND_AUCTION_INITIALIZE,
|
||||
HISTORYTYPE.LAND_AUCTION_INITIALIZE.name(),
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_INITIALIZE,
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_INITIALIZE.name(),
|
||||
doc
|
||||
);
|
||||
|
||||
@@ -110,8 +108,8 @@ public class LandAuctionActivityRepositoryImpl extends BaseDynamoDBRepository<La
|
||||
log.info("LandAuctionActivityDoc Insert Success: {}", objectMapper.writeValueAsString(activityDoc));
|
||||
|
||||
dynamodbHistoryLogService.insertHistoryLog(
|
||||
HISTORYTYPE.LAND_AUCTION_ADD,
|
||||
HISTORYTYPE.LAND_AUCTION_ADD.name(),
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_ADD,
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_ADD.name(),
|
||||
activityDoc
|
||||
);
|
||||
}catch (Exception e){
|
||||
@@ -134,8 +132,8 @@ public class LandAuctionActivityRepositoryImpl extends BaseDynamoDBRepository<La
|
||||
log.info("LandAuctionActivityDoc Update Success: {}", objectMapper.writeValueAsString(afterDoc));
|
||||
|
||||
dynamodbHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPE.LAND_AUCTION_ADD,
|
||||
HISTORYTYPE.LAND_AUCTION_ADD.name(),
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_ADD,
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_ADD.name(),
|
||||
existingDoc,
|
||||
afterDoc
|
||||
);
|
||||
|
||||
@@ -1,30 +1,25 @@
|
||||
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.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.LandAuctionRegistryDoc;
|
||||
import com.caliverse.admin.dynamodb.entity.DynamodbOperationResult;
|
||||
import com.caliverse.admin.dynamodb.repository.BaseDynamoDBRepository;
|
||||
import com.caliverse.admin.dynamodb.repository.LandAuctionHighestBidUserRepository;
|
||||
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.CommonConstants;
|
||||
import com.caliverse.admin.global.common.constants.DynamoDBConstants;
|
||||
import com.caliverse.admin.global.common.exception.RestApiException;
|
||||
import com.caliverse.admin.global.common.utils.CommonUtils;
|
||||
import com.caliverse.admin.history.service.DynamodbHistoryLogService;
|
||||
import com.caliverse.admin.mongodb.service.DynamodbHistoryLogService;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import software.amazon.awssdk.enhanced.dynamodb.Key;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
@@ -76,8 +71,8 @@ public class LandAuctionHighestBidUserRepositoryImpl extends BaseDynamoDBReposit
|
||||
log.info("LandAuctionRegistryDoc Insert Success: {}", objectMapper.writeValueAsString(registry));
|
||||
|
||||
dynamodbHistoryLogService.insertHistoryLog(
|
||||
HISTORYTYPE.LAND_AUCTION_ADD,
|
||||
HISTORYTYPE.LAND_AUCTION_ADD.name(),
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_ADD,
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_ADD.name(),
|
||||
registry
|
||||
);
|
||||
|
||||
@@ -104,8 +99,8 @@ public class LandAuctionHighestBidUserRepositoryImpl extends BaseDynamoDBReposit
|
||||
log.info("LandAuctionHighestBidUserDoc Delete Success: {}", objectMapper.writeValueAsString(doc));
|
||||
|
||||
dynamodbHistoryLogService.deleteHistoryLog(
|
||||
HISTORYTYPE.LAND_AUCTION_INITIALIZE,
|
||||
HISTORYTYPE.LAND_AUCTION_INITIALIZE.name(),
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_INITIALIZE,
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_INITIALIZE.name(),
|
||||
doc
|
||||
);
|
||||
return new DynamodbOperationResult(true, "delete success", doc);
|
||||
|
||||
@@ -1,26 +1,18 @@
|
||||
package com.caliverse.admin.dynamodb.repository.Impl;
|
||||
|
||||
import com.caliverse.admin.domain.entity.HISTORYTYPE;
|
||||
import com.caliverse.admin.dynamodb.domain.doc.LandAuctionActivityDoc;
|
||||
import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
|
||||
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.repository.BaseDynamoDBRepository;
|
||||
import com.caliverse.admin.dynamodb.repository.LandAuctionRecordRepository;
|
||||
import com.caliverse.admin.dynamodb.service.DynamoDBOperations;
|
||||
import com.caliverse.admin.global.common.code.CommonCode;
|
||||
import com.caliverse.admin.global.common.code.ErrorCode;
|
||||
import com.caliverse.admin.global.common.constants.DynamoDBConstants;
|
||||
import com.caliverse.admin.global.common.exception.RestApiException;
|
||||
import com.caliverse.admin.global.common.utils.CommonUtils;
|
||||
import com.caliverse.admin.history.service.DynamodbHistoryLogService;
|
||||
import com.caliverse.admin.mongodb.service.DynamodbHistoryLogService;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import software.amazon.awssdk.enhanced.dynamodb.Key;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
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));
|
||||
|
||||
dynamodbHistoryLogService.deleteHistoryLog(
|
||||
HISTORYTYPE.LAND_AUCTION_INITIALIZE,
|
||||
HISTORYTYPE.LAND_AUCTION_INITIALIZE.name(),
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_INITIALIZE,
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_INITIALIZE.name(),
|
||||
doc
|
||||
);
|
||||
return new DynamodbOperationResult(true, "delete success", doc);
|
||||
|
||||
@@ -1,24 +1,18 @@
|
||||
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.entity.DynamodbOperationResult;
|
||||
import com.caliverse.admin.dynamodb.repository.BaseDynamoDBRepository;
|
||||
import com.caliverse.admin.dynamodb.repository.LandAuctionRefundBidPriceRepository;
|
||||
import com.caliverse.admin.dynamodb.service.DynamoDBOperations;
|
||||
import com.caliverse.admin.global.common.code.CommonCode;
|
||||
import com.caliverse.admin.global.common.code.ErrorCode;
|
||||
import com.caliverse.admin.global.common.constants.DynamoDBConstants;
|
||||
import com.caliverse.admin.global.common.exception.RestApiException;
|
||||
import com.caliverse.admin.global.common.utils.CommonUtils;
|
||||
import com.caliverse.admin.history.service.DynamodbHistoryLogService;
|
||||
import com.caliverse.admin.mongodb.service.DynamodbHistoryLogService;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import software.amazon.awssdk.enhanced.dynamodb.Key;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
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));
|
||||
|
||||
dynamodbHistoryLogService.deleteHistoryLog(
|
||||
HISTORYTYPE.LAND_AUCTION_INITIALIZE,
|
||||
HISTORYTYPE.LAND_AUCTION_INITIALIZE.name(),
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_INITIALIZE,
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_INITIALIZE.name(),
|
||||
doc
|
||||
);
|
||||
return new DynamodbOperationResult(true, "delete success", doc);
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
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.dynamodb.domain.atrrib.BuildingAttrib;
|
||||
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.OwnedBuildingDoc;
|
||||
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.repository.BaseDynamoDBRepository;
|
||||
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.exception.RestApiException;
|
||||
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 lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -97,15 +93,16 @@ public class LandAuctionRegistryRepositoryImpl extends BaseDynamoDBRepository<La
|
||||
registry.setDeletedDateTime(DynamoDBConstants.MIN_DATE);
|
||||
registry.setRestoredDateTime(DynamoDBConstants.MIN_DATE);
|
||||
|
||||
save(registry);
|
||||
|
||||
log.info("LandAuctionRegistryDoc Insert Success: {}", objectMapper.writeValueAsString(registry));
|
||||
|
||||
dynamodbHistoryLogService.insertHistoryLog(
|
||||
HISTORYTYPE.LAND_AUCTION_ADD,
|
||||
HISTORYTYPE.LAND_AUCTION_ADD.name(),
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_ADD,
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_ADD.name(),
|
||||
registry
|
||||
);
|
||||
|
||||
save(registry);
|
||||
}catch (Exception e){
|
||||
log.error("Insert LandAuctionRegistry Error: {}", e.getMessage());
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
||||
@@ -140,8 +137,8 @@ public class LandAuctionRegistryRepositoryImpl extends BaseDynamoDBRepository<La
|
||||
log.info("LandAuctionRegistryDoc Update Success: {}", objectMapper.writeValueAsString(afterDoc));
|
||||
|
||||
dynamodbHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPE.LAND_AUCTION_UPDATE,
|
||||
HISTORYTYPE.LAND_AUCTION_UPDATE.name(),
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_UPDATE,
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_UPDATE.name(),
|
||||
beforeDoc,
|
||||
afterDoc
|
||||
);
|
||||
@@ -178,8 +175,8 @@ public class LandAuctionRegistryRepositoryImpl extends BaseDynamoDBRepository<La
|
||||
log.info("LandAuctionRegistryDoc Update Success: {}", objectMapper.writeValueAsString(afterDoc));
|
||||
|
||||
dynamodbHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPE.LAND_AUCTION_UPDATE,
|
||||
HISTORYTYPE.LAND_AUCTION_UPDATE.name(),
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_UPDATE,
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_UPDATE.name(),
|
||||
beforeDoc,
|
||||
afterDoc
|
||||
);
|
||||
@@ -210,8 +207,8 @@ public class LandAuctionRegistryRepositoryImpl extends BaseDynamoDBRepository<La
|
||||
log.info("LandAuctionRegistryDoc Delete Success: {}", objectMapper.writeValueAsString(doc));
|
||||
|
||||
dynamodbHistoryLogService.deleteHistoryLog(
|
||||
HISTORYTYPE.LAND_AUCTION_INITIALIZE,
|
||||
HISTORYTYPE.LAND_AUCTION_INITIALIZE.name(),
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_INITIALIZE,
|
||||
HISTORYTYPEDETAIL.LAND_AUCTION_INITIALIZE.name(),
|
||||
doc
|
||||
);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
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.dynamodb.domain.atrrib.LandAttrib;
|
||||
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.exception.RestApiException;
|
||||
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 lombok.extern.slf4j.Slf4j;
|
||||
@@ -81,8 +81,8 @@ public class LandRepositoryImpl extends BaseDynamoDBRepository<LandDoc> implemen
|
||||
log.info("LandDoc Insert Success: {}", objectMapper.writeValueAsString(doc));
|
||||
|
||||
dynamodbHistoryLogService.insertHistoryLog(
|
||||
HISTORYTYPE.LAND_OWNER_CHANGE_ADD,
|
||||
HISTORYTYPE.LAND_OWNER_CHANGE_ADD.name(),
|
||||
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_ADD,
|
||||
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_ADD.name(),
|
||||
doc
|
||||
);
|
||||
|
||||
@@ -122,8 +122,8 @@ public class LandRepositoryImpl extends BaseDynamoDBRepository<LandDoc> implemen
|
||||
log.info("LandDoc Update Success: {}", objectMapper.writeValueAsString(afterDoc));
|
||||
|
||||
dynamodbHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPE.LAND_OWNER_CHANGE_UPDATE,
|
||||
HISTORYTYPE.LAND_OWNER_CHANGE_UPDATE.name(),
|
||||
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_UPDATE,
|
||||
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_UPDATE.name(),
|
||||
beforeDoc,
|
||||
afterDoc
|
||||
);
|
||||
@@ -160,8 +160,8 @@ public class LandRepositoryImpl extends BaseDynamoDBRepository<LandDoc> implemen
|
||||
log.info("LandDoc Owned Init Update Success: {}", objectMapper.writeValueAsString(afterDoc));
|
||||
|
||||
dynamodbHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPE.LAND_OWNED_INITIALIZE,
|
||||
HISTORYTYPE.LAND_OWNED_INITIALIZE.name(),
|
||||
HISTORYTYPEDETAIL.LAND_OWNED_INITIALIZE,
|
||||
HISTORYTYPEDETAIL.LAND_OWNED_INITIALIZE.name(),
|
||||
beforeDoc,
|
||||
afterDoc
|
||||
);
|
||||
@@ -201,8 +201,8 @@ public class LandRepositoryImpl extends BaseDynamoDBRepository<LandDoc> implemen
|
||||
log.info("LandDoc Desc Init Update Success: {}", objectMapper.writeValueAsString(afterDoc));
|
||||
|
||||
dynamodbHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPE.LAND_DESC_INITIALIZE,
|
||||
HISTORYTYPE.LAND_DESC_INITIALIZE.name(),
|
||||
HISTORYTYPEDETAIL.LAND_DESC_INITIALIZE,
|
||||
HISTORYTYPEDETAIL.LAND_DESC_INITIALIZE.name(),
|
||||
beforeDoc,
|
||||
afterDoc
|
||||
);
|
||||
|
||||
@@ -1,17 +1,15 @@
|
||||
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.SEARCHTYPE;
|
||||
import com.caliverse.admin.domain.entity.metadata.MetaSystemMailData;
|
||||
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.dto.PageResult;
|
||||
import com.caliverse.admin.dynamodb.entity.MailItem;
|
||||
import com.caliverse.admin.dynamodb.repository.BaseDynamoDBRepository;
|
||||
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.global.common.code.CommonCode;
|
||||
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.utils.CommonUtils;
|
||||
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 lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import software.amazon.awssdk.enhanced.dynamodb.Key;
|
||||
import software.amazon.awssdk.services.dynamodb.model.AttributeValue;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
@@ -83,8 +82,8 @@ public class MailJsonRepositoryImpl extends BaseDynamoDBRepository<MailJsonDoc>
|
||||
log.info("MailDoc Recv Insert Success: {}", objectMapper.writeValueAsString(doc));
|
||||
|
||||
dynamodbHistoryLogService.insertHistoryLog(
|
||||
HISTORYTYPE.LAND_OWNER_CHANGE_MAIL,
|
||||
HISTORYTYPE.LAND_OWNER_CHANGE_MAIL.name(),
|
||||
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_MAIL,
|
||||
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_MAIL.name(),
|
||||
doc
|
||||
);
|
||||
|
||||
@@ -135,4 +134,72 @@ public class MailJsonRepositoryImpl extends BaseDynamoDBRepository<MailJsonDoc>
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
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.SEARCHTYPE;
|
||||
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.doc.MailDoc;
|
||||
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.MailRepository;
|
||||
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.utils.CommonUtils;
|
||||
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 lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import software.amazon.awssdk.enhanced.dynamodb.Key;
|
||||
import software.amazon.awssdk.services.dynamodb.model.AttributeValue;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
@@ -83,14 +83,14 @@ public class MailRepositoryImpl extends BaseDynamoDBRepository<MailDoc> implemen
|
||||
log.info("MailDoc Recv Insert Success: {}", objectMapper.writeValueAsString(doc));
|
||||
|
||||
dynamodbHistoryLogService.insertHistoryLog(
|
||||
HISTORYTYPE.LAND_OWNER_CHANGE_MAIL,
|
||||
HISTORYTYPE.LAND_OWNER_CHANGE_MAIL.name(),
|
||||
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_MAIL,
|
||||
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_MAIL.name(),
|
||||
doc
|
||||
);
|
||||
|
||||
}catch (Exception e){
|
||||
log.error("insert Error: {}", e.getMessage());
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
||||
log.error("RECV Mail Insert Error: {}", e.getMessage());
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_PROCESS_ERROR.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,4 +135,72 @@ public class MailRepositoryImpl extends BaseDynamoDBRepository<MailDoc> implemen
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import com.caliverse.admin.dynamodb.repository.BaseDynamoDBRepository;
|
||||
import com.caliverse.admin.dynamodb.repository.MoneyRepository;
|
||||
import com.caliverse.admin.dynamodb.service.DynamoDBOperations;
|
||||
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 lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.caliverse.admin.dynamodb.repository.Impl;
|
||||
|
||||
import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
|
||||
import com.caliverse.admin.dynamodb.domain.atrrib.NicknameAttrib;
|
||||
import com.caliverse.admin.dynamodb.domain.doc.NicknameDoc;
|
||||
import com.caliverse.admin.dynamodb.repository.BaseDynamoDBRepository;
|
||||
@@ -9,13 +10,16 @@ import com.caliverse.admin.global.common.code.CommonCode;
|
||||
import com.caliverse.admin.global.common.code.ErrorCode;
|
||||
import com.caliverse.admin.global.common.constants.DynamoDBConstants;
|
||||
import com.caliverse.admin.global.common.exception.RestApiException;
|
||||
import com.caliverse.admin.history.service.DynamodbHistoryLogService;
|
||||
import com.caliverse.admin.global.common.utils.CommonUtils;
|
||||
import com.caliverse.admin.mongodb.service.DynamodbHistoryLogService;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import software.amazon.awssdk.enhanced.dynamodb.Key;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class NicknameRepositoryImpl extends BaseDynamoDBRepository<NicknameDoc> implements NicknameRepository {
|
||||
@@ -40,4 +44,40 @@ public class NicknameRepositoryImpl extends BaseDynamoDBRepository<NicknameDoc>
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateNickname(String guid, String newNickname) {
|
||||
Key key = Key.builder()
|
||||
.partitionValue(DynamoDBConstants.PK_KEY_NICKNAME + guid)
|
||||
.sortValue(DynamoDBConstants.EMPTY)
|
||||
.build();
|
||||
|
||||
try {
|
||||
NicknameDoc beforeDoc = findById(key);
|
||||
|
||||
if (beforeDoc != null) {
|
||||
NicknameDoc afterDoc = deepCopy(beforeDoc, NicknameDoc.class);
|
||||
|
||||
NicknameAttrib attrib = CommonUtils.stringByObject(afterDoc.getAttribValue(), NicknameAttrib.class);
|
||||
attrib.setNickname(newNickname);
|
||||
|
||||
afterDoc.setAttribValue(CommonUtils.objectByString(attrib));
|
||||
afterDoc.setUpdatedDateTime(CommonUtils.convertUTCDate(LocalDateTime.now()));
|
||||
|
||||
update(afterDoc);
|
||||
|
||||
log.info("NicknameDoc Update Success: {}", objectMapper.writeValueAsString(afterDoc));
|
||||
|
||||
dynamodbHistoryLogService.updateHistoryLog(
|
||||
HISTORYTYPEDETAIL.NICKNAME_UPDATE,
|
||||
HISTORYTYPEDETAIL.NICKNAME_UPDATE.name(),
|
||||
beforeDoc,
|
||||
afterDoc
|
||||
);
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("Update Nickname Error: {}", e.getMessage());
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
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.doc.OwnedBuildingDoc;
|
||||
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.constants.DynamoDBConstants;
|
||||
import com.caliverse.admin.global.common.exception.RestApiException;
|
||||
import com.caliverse.admin.global.common.utils.CommonUtils;
|
||||
import com.caliverse.admin.history.service.DynamodbHistoryLogService;
|
||||
import com.caliverse.admin.mongodb.service.DynamodbHistoryLogService;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -73,8 +72,8 @@ public class OwnedBuildingRepositoryImpl extends BaseDynamoDBRepository<OwnedBui
|
||||
log.info("OwnedBuildingDoc Insert Success: {}", objectMapper.writeValueAsString(doc));
|
||||
|
||||
dynamodbHistoryLogService.insertHistoryLog(
|
||||
HISTORYTYPE.LAND_OWNER_CHANGE_ADD,
|
||||
HISTORYTYPE.LAND_OWNER_CHANGE_ADD.name(),
|
||||
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_ADD,
|
||||
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_ADD.name(),
|
||||
doc
|
||||
);
|
||||
|
||||
@@ -99,8 +98,8 @@ public class OwnedBuildingRepositoryImpl extends BaseDynamoDBRepository<OwnedBui
|
||||
log.info("OwnedBuildingDoc Delete Success: {}", objectMapper.writeValueAsString(doc));
|
||||
|
||||
dynamodbHistoryLogService.deleteHistoryLog(
|
||||
HISTORYTYPE.LAND_OWNER_CHANGE_UPDATE,
|
||||
HISTORYTYPE.LAND_OWNER_CHANGE_UPDATE.name(),
|
||||
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_UPDATE,
|
||||
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_UPDATE.name(),
|
||||
doc
|
||||
);
|
||||
}catch (Exception e){
|
||||
@@ -124,8 +123,8 @@ public class OwnedBuildingRepositoryImpl extends BaseDynamoDBRepository<OwnedBui
|
||||
log.info("OwnedBuildingDoc Delete Success: {}", objectMapper.writeValueAsString(doc));
|
||||
|
||||
dynamodbHistoryLogService.deleteHistoryLog(
|
||||
HISTORYTYPE.LAND_OWNED_INITIALIZE,
|
||||
HISTORYTYPE.LAND_OWNED_INITIALIZE.name(),
|
||||
HISTORYTYPEDETAIL.LAND_OWNED_INITIALIZE,
|
||||
HISTORYTYPEDETAIL.LAND_OWNED_INITIALIZE.name(),
|
||||
doc
|
||||
);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
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.doc.OwnedLandDoc;
|
||||
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.constants.DynamoDBConstants;
|
||||
import com.caliverse.admin.global.common.exception.RestApiException;
|
||||
import com.caliverse.admin.global.common.utils.CommonUtils;
|
||||
import com.caliverse.admin.history.service.DynamodbHistoryLogService;
|
||||
import com.caliverse.admin.mongodb.service.DynamodbHistoryLogService;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -73,8 +72,8 @@ public class OwnedLandRepositoryImpl extends BaseDynamoDBRepository<OwnedLandDoc
|
||||
log.info("OwnedLandDoc Insert Success: {}", objectMapper.writeValueAsString(doc));
|
||||
|
||||
dynamodbHistoryLogService.insertHistoryLog(
|
||||
HISTORYTYPE.LAND_OWNER_CHANGE_ADD,
|
||||
HISTORYTYPE.LAND_OWNER_CHANGE_ADD.name(),
|
||||
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_ADD,
|
||||
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_ADD.name(),
|
||||
doc
|
||||
);
|
||||
|
||||
@@ -99,8 +98,8 @@ public class OwnedLandRepositoryImpl extends BaseDynamoDBRepository<OwnedLandDoc
|
||||
log.info("OwnedLandDoc Delete Success: {}", objectMapper.writeValueAsString(doc));
|
||||
|
||||
dynamodbHistoryLogService.deleteHistoryLog(
|
||||
HISTORYTYPE.LAND_OWNER_CHANGE_UPDATE,
|
||||
HISTORYTYPE.LAND_OWNER_CHANGE_UPDATE.name(),
|
||||
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_UPDATE,
|
||||
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_UPDATE.name(),
|
||||
doc
|
||||
);
|
||||
}catch (Exception e){
|
||||
@@ -124,8 +123,8 @@ public class OwnedLandRepositoryImpl extends BaseDynamoDBRepository<OwnedLandDoc
|
||||
log.info("OwnedLandDoc Delete Success: {}", objectMapper.writeValueAsString(doc));
|
||||
|
||||
dynamodbHistoryLogService.deleteHistoryLog(
|
||||
HISTORYTYPE.LAND_OWNER_CHANGE_UPDATE,
|
||||
HISTORYTYPE.LAND_OWNER_CHANGE_UPDATE.name(),
|
||||
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_UPDATE,
|
||||
HISTORYTYPEDETAIL.LAND_OWNER_CHANGE_UPDATE.name(),
|
||||
doc
|
||||
);
|
||||
return new DynamodbOperationResult(true, "", doc);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.caliverse.admin.dynamodb.repository.Impl;
|
||||
|
||||
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.dynamodb.domain.atrrib.SystemMetaMailAttrib;
|
||||
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.global.common.code.CommonCode;
|
||||
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.exception.RestApiException;
|
||||
import com.caliverse.admin.global.common.utils.CommonUtils;
|
||||
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 lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -61,8 +59,8 @@ public class SystemMetaMailRepositoryImpl extends BaseDynamoDBRepository<SystemM
|
||||
save(doc);
|
||||
|
||||
dynamodbHistoryLogService.insertHistoryLog(
|
||||
HISTORYTYPE.EVENT_ADD,
|
||||
HISTORYTYPE.EVENT_ADD.name(),
|
||||
HISTORYTYPEDETAIL.EVENT_ADD,
|
||||
HISTORYTYPEDETAIL.EVENT_ADD.name(),
|
||||
doc
|
||||
);
|
||||
|
||||
|
||||
@@ -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.UserBaseRepository;
|
||||
import com.caliverse.admin.dynamodb.service.DynamoDBOperations;
|
||||
import com.caliverse.admin.global.common.code.CommonCode;
|
||||
import com.caliverse.admin.global.common.code.ErrorCode;
|
||||
import com.caliverse.admin.global.common.constants.DynamoDBConstants;
|
||||
import com.caliverse.admin.global.common.exception.RestApiException;
|
||||
import com.caliverse.admin.global.common.utils.CommonUtils;
|
||||
import com.caliverse.admin.history.service.DynamodbHistoryLogService;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.caliverse.admin.mongodb.service.DynamodbHistoryLogService;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.caliverse.admin.dynamodb.repository.Impl;
|
||||
|
||||
import com.caliverse.admin.dynamodb.domain.atrrib.AccountBaseAttrib;
|
||||
import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
|
||||
import com.caliverse.admin.dynamodb.domain.atrrib.UserNicknameRegistryAttrib;
|
||||
import com.caliverse.admin.dynamodb.domain.doc.UserNicknameRegistryDoc;
|
||||
import com.caliverse.admin.dynamodb.repository.BaseDynamoDBRepository;
|
||||
@@ -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.exception.RestApiException;
|
||||
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.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
@@ -19,6 +19,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import software.amazon.awssdk.enhanced.dynamodb.Key;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -89,4 +90,63 @@ public class UserNicknameRegistryRepositoryImpl extends BaseDynamoDBRepository<U
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteNickname(String nickname) {
|
||||
Key key = Key.builder()
|
||||
.partitionValue(DynamoDBConstants.PK_KEY_USER_NICKNAME_REGISTRY)
|
||||
.sortValue(nickname.toLowerCase())
|
||||
.build();
|
||||
|
||||
try {
|
||||
UserNicknameRegistryDoc beforeDoc = findById(key);
|
||||
|
||||
if (beforeDoc != null) {
|
||||
delete(key);
|
||||
|
||||
log.info("UserNicknameRegistryDoc Delete Success: {}", objectMapper.writeValueAsString(beforeDoc));
|
||||
|
||||
dynamodbHistoryLogService.deleteHistoryLog(
|
||||
HISTORYTYPEDETAIL.NICKNAME_REGISTRY_DELETE,
|
||||
HISTORYTYPEDETAIL.NICKNAME_REGISTRY_DELETE.name(),
|
||||
beforeDoc
|
||||
);
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("Delete UserNicknameRegistry Error: {}", e.getMessage());
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertChangesNickname(UserNicknameRegistryDoc beforeDoc, String newNickname) {
|
||||
LocalDateTime nowDate = LocalDateTime.now();
|
||||
|
||||
try {
|
||||
if (beforeDoc != null) {
|
||||
UserNicknameRegistryDoc afterDoc = deepCopy(beforeDoc, UserNicknameRegistryDoc.class);
|
||||
|
||||
UserNicknameRegistryAttrib attrib = CommonUtils.stringByObject(afterDoc.getAttribValue(), UserNicknameRegistryAttrib.class);
|
||||
attrib.setNickname(newNickname.toLowerCase());
|
||||
|
||||
afterDoc.setSK(newNickname.toLowerCase());
|
||||
afterDoc.setAttribValue(CommonUtils.objectByString(attrib));
|
||||
afterDoc.setCreatedDateTime(CommonUtils.convertUTCDate(nowDate));
|
||||
afterDoc.setUpdatedDateTime(CommonUtils.convertUTCDate(nowDate));
|
||||
|
||||
save(afterDoc);
|
||||
|
||||
log.info("UserNicknameRegistryDoc Insert Success: {}", objectMapper.writeValueAsString(afterDoc));
|
||||
|
||||
dynamodbHistoryLogService.insertHistoryLog(
|
||||
HISTORYTYPEDETAIL.NICKNAME_REGISTRY_ADD,
|
||||
HISTORYTYPEDETAIL.NICKNAME_REGISTRY_ADD.name(),
|
||||
afterDoc
|
||||
);
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("Insert UserNicknameRegistry Error: {}", e.getMessage());
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.dto.PageResult;
|
||||
import com.caliverse.admin.dynamodb.entity.MailItem;
|
||||
import software.amazon.awssdk.enhanced.dynamodb.Key;
|
||||
import software.amazon.awssdk.services.dynamodb.model.AttributeValue;
|
||||
|
||||
import java.util.List;
|
||||
@@ -22,4 +23,6 @@ public interface MailJsonRepository extends DynamoDBRepository<MailJsonDoc> {
|
||||
String sortKeyPrefix,
|
||||
Map<String, AttributeValue> exclusiveStartKey
|
||||
);
|
||||
void deleteMail(Key key);
|
||||
void deleteMailItem(Key key, Integer itemId, double count, double newCount);
|
||||
}
|
||||
|
||||
@@ -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.dto.PageResult;
|
||||
import com.caliverse.admin.dynamodb.entity.MailItem;
|
||||
import software.amazon.awssdk.enhanced.dynamodb.Key;
|
||||
import software.amazon.awssdk.services.dynamodb.model.AttributeValue;
|
||||
|
||||
import java.util.List;
|
||||
@@ -24,4 +25,6 @@ public interface MailRepository extends DynamoDBRepository<MailDoc> {
|
||||
String sortKeyPrefix,
|
||||
Map<String, AttributeValue> exclusiveStartKey
|
||||
);
|
||||
void deleteMail(Key key);
|
||||
void deleteMailItem(Key key, Integer itemId, double count, double newCount);
|
||||
}
|
||||
|
||||
@@ -5,4 +5,5 @@ import com.caliverse.admin.dynamodb.domain.doc.NicknameDoc;
|
||||
|
||||
public interface NicknameRepository extends DynamoDBRepository<NicknameDoc> {
|
||||
NicknameAttrib findUser(String guid);
|
||||
void updateNickname(String guid, String newNickname);
|
||||
}
|
||||
|
||||
@@ -10,4 +10,6 @@ public interface UserNicknameRegistryRepository extends DynamoDBRepository<UserN
|
||||
UserNicknameRegistryAttrib findUser(String nickname);
|
||||
List<String> findAllNicknameByGuid();
|
||||
List<UserNicknameRegistryAttrib> findAllAttrib();
|
||||
void deleteNickname(String nickname);
|
||||
void insertChangesNickname(UserNicknameRegistryDoc beforeDoc, String newNickname);
|
||||
}
|
||||
|
||||
@@ -5,12 +5,11 @@ import com.caliverse.admin.domain.entity.metadata.MetaLandData;
|
||||
import com.caliverse.admin.domain.service.LandService;
|
||||
import com.caliverse.admin.dynamodb.domain.atrrib.LandAttrib;
|
||||
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.repository.*;
|
||||
import com.caliverse.admin.global.common.constants.DynamoDBConstants;
|
||||
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.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -93,6 +93,57 @@ public class DynamodbItemService {
|
||||
.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
|
||||
public void updateItemStack(String guid, String itemGuid, int stackCount){
|
||||
itemRepository.updateItemStack(guid, itemGuid, stackCount);
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.caliverse.admin.dynamodb.service;
|
||||
|
||||
import com.caliverse.admin.domain.entity.EInitDataType;
|
||||
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.dynamodb.domain.atrrib.LandAuctionRefundBidPriceAttrib;
|
||||
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.global.common.constants.DynamoDBConstants;
|
||||
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.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -95,7 +94,7 @@ public class DynamodbLandAuctionService {
|
||||
if(registryResult.isSuccess()){
|
||||
if(registryResult.getData() != null) dataList.add(registryResult.getData());
|
||||
}else{
|
||||
historySave(EInitDataType.LandAuction, tranId, false, registryResult.getMessage(), dataList, map);
|
||||
historySave(EInitDataType.LandAuction, false, registryResult.getMessage(), dataList, map);
|
||||
throw new RuntimeException(registryResult.getMessage());
|
||||
}
|
||||
|
||||
@@ -103,7 +102,7 @@ public class DynamodbLandAuctionService {
|
||||
if(activityResult.isSuccess()){
|
||||
if(activityResult.getData() != null) dataList.add(activityResult.getData());
|
||||
}else{
|
||||
historySave(EInitDataType.LandAuction, tranId, false, activityResult.getMessage(), dataList, map);
|
||||
historySave(EInitDataType.LandAuction, false, activityResult.getMessage(), dataList, map);
|
||||
throw new RuntimeException(activityResult.getMessage());
|
||||
}
|
||||
|
||||
@@ -111,7 +110,7 @@ public class DynamodbLandAuctionService {
|
||||
if(highestBidUserResult.isSuccess()){
|
||||
if(highestBidUserResult.getData() != null) dataList.add(highestBidUserResult.getData());
|
||||
}else{
|
||||
historySave(EInitDataType.LandAuction, tranId, false, highestBidUserResult.getMessage(), dataList, map);
|
||||
historySave(EInitDataType.LandAuction, false, highestBidUserResult.getMessage(), dataList, map);
|
||||
throw new RuntimeException(highestBidUserResult.getMessage());
|
||||
}
|
||||
|
||||
@@ -119,7 +118,7 @@ public class DynamodbLandAuctionService {
|
||||
if(recordResult.isSuccess()){
|
||||
if(recordResult.getData() != null) dataList.add(recordResult.getData());
|
||||
}else{
|
||||
historySave(EInitDataType.LandAuction, tranId, false, recordResult.getMessage(), dataList, map);
|
||||
historySave(EInitDataType.LandAuction, false, recordResult.getMessage(), dataList, map);
|
||||
throw new RuntimeException(recordResult.getMessage());
|
||||
}
|
||||
if(guid != null && !guid.isEmpty()) {
|
||||
@@ -128,7 +127,7 @@ public class DynamodbLandAuctionService {
|
||||
if (refundBidPriceResult.isSuccess()) {
|
||||
if (refundBidPriceResult.getData() != null) dataList.add(refundBidPriceResult.getData());
|
||||
} else {
|
||||
historySave(EInitDataType.LandAuction, tranId, false, refundBidPriceResult.getMessage(), dataList, map);
|
||||
historySave(EInitDataType.LandAuction, false, refundBidPriceResult.getMessage(), dataList, map);
|
||||
throw new RuntimeException(refundBidPriceResult.getMessage());
|
||||
}
|
||||
}else{
|
||||
@@ -142,28 +141,28 @@ public class DynamodbLandAuctionService {
|
||||
if (refundBidPriceResult.isSuccess()) {
|
||||
if (refundBidPriceResult.getData() != null) dataList.add(refundBidPriceResult.getData());
|
||||
} else {
|
||||
historySave(EInitDataType.LandAuction, tranId, false, refundBidPriceResult.getMessage(), dataList, map);
|
||||
historySave(EInitDataType.LandAuction, false, refundBidPriceResult.getMessage(), dataList, map);
|
||||
throw new RuntimeException(refundBidPriceResult.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
historySave(EInitDataType.LandAuction, tranId, true, "", dataList, map);
|
||||
historySave(EInitDataType.LandAuction, true, "", dataList, map);
|
||||
|
||||
}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());
|
||||
}
|
||||
}
|
||||
|
||||
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()) {
|
||||
dataList.forEach(data -> {
|
||||
if(data != null)
|
||||
dataInitializeHistoryService.dynamodbDataInitHistory(dataType, tranId, isSuccess, msg, data, map);
|
||||
dataInitializeHistoryService.dynamodbDataInitHistory(dataType, isSuccess, msg, data, map);
|
||||
});
|
||||
}else{
|
||||
dataInitializeHistoryService.dynamodbDataInitHistory(dataType, tranId, isSuccess, msg, null, map);
|
||||
dataInitializeHistoryService.dynamodbDataInitHistory(dataType, isSuccess, msg, null, map);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.constants.DynamoDBConstants;
|
||||
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.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -170,10 +170,10 @@ public class DynamodbLandService {
|
||||
if(!dataList.isEmpty()) {
|
||||
dataList.forEach(data -> {
|
||||
if (data != null)
|
||||
dataInitializeHistoryService.dynamodbDataInitHistory(dataType, tranId, isSuccess, msg, data, map);
|
||||
dataInitializeHistoryService.dynamodbDataInitHistory(dataType, isSuccess, msg, data, map);
|
||||
});
|
||||
}else{
|
||||
dataInitializeHistoryService.dynamodbDataInitHistory(dataType, tranId, isSuccess, msg, null, map);
|
||||
dataInitializeHistoryService.dynamodbDataInitHistory(dataType, isSuccess, msg, null, map);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -52,7 +52,6 @@ public class DynamodbService {
|
||||
|
||||
private final IndicatorsMoneyService moneyService;
|
||||
|
||||
private final ObjectMapper mapper = new ObjectMapper();
|
||||
private final MetaDataHandler metaDataHandler;
|
||||
|
||||
public void saveUserMoney(){
|
||||
@@ -72,58 +71,4 @@ public class DynamodbService {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,13 +2,19 @@ package com.caliverse.admin.dynamodb.service;
|
||||
|
||||
import com.caliverse.admin.domain.entity.BlackList;
|
||||
import com.caliverse.admin.dynamodb.domain.atrrib.*;
|
||||
import com.caliverse.admin.dynamodb.domain.doc.UserNicknameRegistryDoc;
|
||||
import com.caliverse.admin.dynamodb.entity.EAuthAdminLevelType;
|
||||
import com.caliverse.admin.dynamodb.repository.*;
|
||||
import com.caliverse.admin.global.common.annotation.DynamoDBTransaction;
|
||||
import com.caliverse.admin.global.common.code.CommonCode;
|
||||
import com.caliverse.admin.global.common.code.ErrorCode;
|
||||
import com.caliverse.admin.global.common.constants.DynamoDBConstants;
|
||||
import com.caliverse.admin.global.common.exception.RestApiException;
|
||||
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;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@@ -90,7 +96,7 @@ public class DynamodbUserService {
|
||||
}
|
||||
|
||||
public String getNameByGuid(String nickname){
|
||||
UserNicknameRegistryAttrib nicknameRegistryAttrib = userNicknameRegistryRepository.findUser(nickname);
|
||||
UserNicknameRegistryAttrib nicknameRegistryAttrib = userNicknameRegistryRepository.findUser(nickname.toLowerCase());
|
||||
if(nicknameRegistryAttrib == null){
|
||||
log.error("getNameByGuid UserNicknameRegistry Null nickname: {}", nickname);
|
||||
return "";
|
||||
@@ -124,4 +130,26 @@ public class DynamodbUserService {
|
||||
return moneyRepository.findAttrib(guid);
|
||||
}
|
||||
|
||||
@DynamoDBTransaction
|
||||
public void changesNickname(String guid, String oldNickname, String newNickname){
|
||||
UserNicknameRegistryAttrib newNicknameAttrib = userNicknameRegistryRepository.findUser(newNickname.toLowerCase());
|
||||
if(newNicknameAttrib != null){
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.NICKNAME_EXIT_ERROR.toString());
|
||||
}
|
||||
|
||||
Key key = Key.builder()
|
||||
.partitionValue(DynamoDBConstants.PK_KEY_USER_NICKNAME_REGISTRY)
|
||||
.sortValue(oldNickname.toLowerCase())
|
||||
.build();
|
||||
UserNicknameRegistryDoc beforeDoc = userNicknameRegistryRepository.findById(key);
|
||||
if(beforeDoc == null){
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.DYNAMODB_NOT_USER.toString());
|
||||
}
|
||||
|
||||
userNicknameRegistryRepository.deleteNickname(oldNickname);
|
||||
userNicknameRegistryRepository.insertChangesNickname(beforeDoc, newNickname);
|
||||
|
||||
nicknameRepository.updateNickname(guid, newNickname);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ public class DynamoDBTransactionAspect {
|
||||
} catch (Exception e) {
|
||||
log.error("DynamoDB operation error: {}", e.getMessage());
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(),
|
||||
ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage());
|
||||
e.getMessage().isEmpty() ? ErrorCode.DYNAMODB_CONNECTION_ERROR.getMessage() : e.getMessage());
|
||||
} finally {
|
||||
// 트랜잭션 컨텍스트 정리
|
||||
DynamoDBTransactionContext.clear();
|
||||
|
||||
@@ -14,6 +14,7 @@ public enum ErrorCode {
|
||||
USER_GAME_LOGIN_JSON_MAPPER_PARSE_ERROR("유저 게임세션 데이터 파싱하는 도중 에러가 발생했습니다."),
|
||||
JSON_PARSE_ERROR("데이터 파싱 에러"),
|
||||
|
||||
NOT_USER("존재하지 않는 유저입니다."),
|
||||
WRONG_TYPE_TOKEN("잘못된 타입의 토큰입니다."),
|
||||
EXPIRED_TOKEN("만료된 토큰입니다."),
|
||||
PWD_EXPIRATION("비밀번호 기간 만료"),
|
||||
@@ -75,6 +76,7 @@ public enum ErrorCode {
|
||||
|
||||
//Battle
|
||||
ERROR_BATTLE_EVENT_TIME_OVER("해당 시간에 속하는 이벤트가 존재합니다."),
|
||||
ERROR_BATTLE_EVENT_CONFIG("설정값이 없는 데이터가 있다."),
|
||||
ERROR_BATTLE_EVENT_STATUS_IMPOSSIBLE("수정할 수 없는 이벤트상태입니다."),
|
||||
ERROR_BATTLE_EVENT_STATUS_START_IMPOSSIBLE("진행중인 이벤트상태입니다."),
|
||||
|
||||
@@ -117,6 +119,8 @@ public enum ErrorCode {
|
||||
DYNAMODB_ITEM_DELETE_ERROR("아이템 삭제 중 오류가 발생하였습니다."),
|
||||
DYNAMODB_ITEM_UPDATE_ERROR("아이템 수정 중 오류가 발생하였습니다."),
|
||||
|
||||
DYNAMODB_MAIL_NOT_ITEM_ERROR("우편에 해당 아이템이 존재하지 않습니다."),
|
||||
|
||||
SENDMAIL_ERROR("메일 발송중 오류가 발생하였습니다. 관리자에게 문의주세요."),
|
||||
|
||||
EXCEPTION_INVALID_PROTOCOL_BUFFER_EXCEPTION_ERROR("InvalidProtocolBufferException"),
|
||||
|
||||
@@ -14,6 +14,7 @@ public class AdminConstants {
|
||||
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_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_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_LOGMINUTE = "logMinute";
|
||||
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_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_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_CREATE_TIME = "createdTime";
|
||||
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_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_PLAY_TIME = "\"Action\":\"UserLogout\"";
|
||||
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_WEEK_NUM = 7;
|
||||
|
||||
@@ -17,6 +17,10 @@ public class CommonConstants {
|
||||
public static final String SYSTEM_MAIL_LAND_TRANS_KEY = "LandTrans";
|
||||
public static final int DYNAMODB_PAGING_SIZE = 30;
|
||||
public static final String S3_MENU_BANNER_DIRECTORY = "banner-";
|
||||
public static final String GUID = "GUID";
|
||||
public static final String NICKNAME = "NICKNAME";
|
||||
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_NANO = "yyyy-MM-dd'T'HH:mm:ss.SSSSSSS'Z'";
|
||||
|
||||
@@ -5,9 +5,12 @@ public class MysqlConstants {
|
||||
public static String TABLE_NAME_LAND_OWNER_CHANGE = "land_ownership_changes";
|
||||
public static String TABLE_NAME_CALIUM_REQUEST = "calium_request";
|
||||
public static String TABLE_NAME_EVENT = "event";
|
||||
public static String TABLE_NAME_ADMIN = "admin";
|
||||
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_NOTICE = "notice";
|
||||
public static String TABLE_NAME_BATTLE_EVENT = "battle_event";
|
||||
public static String TABLE_NAME_MESSAGE = "message";
|
||||
public static String TABLE_NAME_DATA_INIT = "data_initialize_schedule";
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import com.caliverse.admin.global.common.constants.CommonConstants;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
@@ -57,6 +58,7 @@ public class ExcelUtils {
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
switch (cell.getCellType()) {
|
||||
case STRING: // getRichStringCellValue() 메소드를 사용하여 컨텐츠를 읽음
|
||||
value = cell.getRichStringCellValue().getString();
|
||||
@@ -202,6 +204,64 @@ public class ExcelUtils {
|
||||
return excelList;
|
||||
}
|
||||
|
||||
public List<Excel> getListData(MultipartFile file){
|
||||
List<Excel> excelList = new ArrayList<Excel>();
|
||||
|
||||
try {
|
||||
Workbook workbook = null;
|
||||
|
||||
String ext = FilenameUtils.getExtension(file.getOriginalFilename()).toLowerCase();
|
||||
if(!ext.equals("xlsx") && !ext.equals("xls")){
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.NOT_EXIT_EXCEL.getMessage() ); //Excel 파일을 선택해주세요.
|
||||
}
|
||||
if (ext.equals("xls")){
|
||||
workbook = new HSSFWorkbook(file.getInputStream());
|
||||
}else{
|
||||
workbook = new XSSFWorkbook(file.getInputStream());
|
||||
}
|
||||
|
||||
// 첫번째 시트
|
||||
Sheet sheet = workbook.getSheetAt(0);
|
||||
|
||||
int rowIndex = 0;
|
||||
|
||||
// 첫번째 행(0)은 컬럼 명이기 때문에 두번째 행(1) 부터 검색
|
||||
for (rowIndex = 1; rowIndex < sheet.getLastRowNum() + 1; rowIndex++) {
|
||||
Row row = sheet.getRow(rowIndex);
|
||||
|
||||
if(row == null || row.getCell(0).toString().isBlank()) continue;
|
||||
|
||||
Excel rowData = new Excel();
|
||||
|
||||
Cell userCell = row.getCell(0);
|
||||
Cell typeCell = row.getCell(1);
|
||||
|
||||
if(getCellValue(typeCell).equals(CommonConstants.GUID)){
|
||||
if(!isString32Characters(getCellValue(userCell))){
|
||||
log.error("getListData : Excel Upload Guid Check Fail type {}, user {}", typeCell, userCell);
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.GUID_LENGTH_CHECK.getMessage() ); //guid 32자 체크
|
||||
}
|
||||
}else if(getCellValue(typeCell).equals(CommonConstants.NICKNAME) || getCellValue(typeCell).equals(CommonConstants.EMAIL)){
|
||||
}else{
|
||||
log.error("getListData : Excel Upload Type Error type {}, user {}", typeCell, userCell);
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.USERTYPE_CHECK_EXCEL.getMessage() );
|
||||
}
|
||||
|
||||
rowData.setUser(getCellValue(userCell));
|
||||
rowData.setType(getCellValue(typeCell));
|
||||
|
||||
excelList.add(rowData);
|
||||
}
|
||||
|
||||
} catch (InvalidFormatException e) {
|
||||
log.info("getListData Invalid Excel Format:" + e.getMessage());
|
||||
} catch (IOException e) {
|
||||
log.info("getListData IOException Excel Format:" + e.getMessage());
|
||||
}
|
||||
|
||||
return excelList;
|
||||
}
|
||||
|
||||
public void excelDownload(String sheetName, String headerNames[], String bodyDatass[][],String outfileName
|
||||
, HttpServletResponse res) throws IOException {
|
||||
|
||||
@@ -321,6 +381,19 @@ public class ExcelUtils {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean hasDuplicatesExcel(List<Excel> dataList) {
|
||||
Set<String> uniqueValues = new HashSet<>();
|
||||
|
||||
for (Excel excel : dataList) {
|
||||
if(uniqueValues.contains(excel.getUser())){
|
||||
return true;
|
||||
}
|
||||
uniqueValues.add(excel.getUser());
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isString32Characters(String input) {
|
||||
if (input == null) {
|
||||
return false;
|
||||
|
||||
@@ -47,7 +47,11 @@ public class MongoBusinessLogConfig {
|
||||
String auth = username.isEmpty() ? "" : String.format("%s:%s@",username, encodePassword);
|
||||
String connection;
|
||||
if(activeProfile.equals("local") || activeProfile.equals("dev")) {
|
||||
connection = String.format("mongodb://%s%s/?authSource=%s", 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);
|
||||
}
|
||||
}else{
|
||||
connection = String.format("mongodb+srv://%s%s/%s?retryWrites=true&w=majority&appName=backoffice-%s", auth, businessLogHost, businessLogdb, activeProfile);
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ import java.nio.charset.StandardCharsets;
|
||||
|
||||
|
||||
@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 {
|
||||
|
||||
// @Value("${mongodb.indicator.uri}")
|
||||
|
||||
@@ -26,10 +26,14 @@ public class S3Config {
|
||||
@Bean
|
||||
@ConditionalOnProperty(name = "amazon.s3.enabled", havingValue = "true")
|
||||
public S3Client s3Client() {
|
||||
AwsBasicCredentials credentials = AwsBasicCredentials.create(accessKey, secretKey);
|
||||
if(!accessKey.isEmpty()) {
|
||||
AwsBasicCredentials credentials = AwsBasicCredentials.create(accessKey, secretKey);
|
||||
return S3Client.builder()
|
||||
.credentialsProvider(StaticCredentialsProvider.create(credentials))
|
||||
.region(Region.of(region))
|
||||
.build();
|
||||
}
|
||||
return S3Client.builder()
|
||||
.credentialsProvider(StaticCredentialsProvider.create(credentials))
|
||||
.region(Region.of(region))
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
package com.caliverse.admin.history.domain;
|
||||
|
||||
public interface historyLog {
|
||||
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
package com.caliverse.admin.history.repository;
|
||||
|
||||
|
||||
|
||||
public interface MongoAdminRepository {
|
||||
}
|
||||
@@ -1,17 +1,27 @@
|
||||
package com.caliverse.admin.logs.Indicatordomain;
|
||||
|
||||
import com.caliverse.admin.global.common.constants.AdminConstants;
|
||||
import com.caliverse.admin.global.common.utils.CommonUtils;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.springframework.data.mongodb.core.mapping.Document;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Document(collection = AdminConstants.MONGO_DB_COLLECTION_LOG)
|
||||
@Getter
|
||||
@Setter
|
||||
public class GenericMongoLog extends MongoLogSearchBase{
|
||||
// private Map<String, Object> parseMessage;
|
||||
private Map<String, Object> header;
|
||||
private Map<String, Object> body;
|
||||
private String message;
|
||||
|
||||
public Map getMessage() {
|
||||
if (message == null || message.isEmpty()) {
|
||||
return new HashMap<>();
|
||||
}
|
||||
return CommonUtils.stringByObject(message, Map.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -215,6 +215,25 @@ public enum LogAction {
|
||||
UserLogout("유저 로그아웃"),
|
||||
UserLogoutSnapShot("게임 로그아웃 스냅샷"),
|
||||
UserReport("유저 신고"),
|
||||
ItemDestroyByUser("아이템 제거 (사용자에 의해)"),
|
||||
ItemDestoryByExpiration("아이템 제거 (기간만료에 의해)"),
|
||||
|
||||
// 퀘스트 관련
|
||||
QuestMainAssign("퀘스트 메인 수락"),
|
||||
|
||||
// 비컨 상점 관련
|
||||
BeaconShopRegisterItem("비컨 상점에 아이템 등록"),
|
||||
BeaconShopReturnItem("비컨 상점 아이템 회수"),
|
||||
BeaconShopPurchaseItem("비컨 상점에서 아이템 구매"),
|
||||
BeaconShopReceivePaymentForSales("비컨 상점 판매한 아이템 정산 받기"),
|
||||
BeaconShopSearchItem("비컨 상점 아이템 검색"),
|
||||
BeaconShopUpdateDailyCount("비컨 상점 하루 제한 업데이트"),
|
||||
BeaconShopDeleteRecord("비컨 상점 기록 영수증 제거"),
|
||||
BeaconShopDeactiveItems("비컨 상점 아이템 비활성화"),
|
||||
|
||||
// 치트 명령어 관련
|
||||
CheatCommandBeaconShopItemTimeChange("치트로 인한 비컨 상점 시간 변경"),
|
||||
CheatCommandDailyLimitInit("치트로 인한 비컨 상점 일일 횟수 초기화"),
|
||||
Warp("워프");
|
||||
|
||||
|
||||
|
||||
@@ -74,6 +74,16 @@ public enum LogDomain {
|
||||
BattleRoomJoin("전투 입장"),
|
||||
BattleDead("전투 죽음"),
|
||||
BattleRound("전투 라운드"),
|
||||
BeaconShopSoldRecord("비컨 상점 영수증"),
|
||||
BeaconShopSoldPrice("비컨 상점 정산금"),
|
||||
|
||||
// BrokerApi 하위 도메인들
|
||||
PlanetProviderAuth("플래닛 컨텐츠 제공자 인증"),
|
||||
PlanetUserAuth("플래닛 유저 인증"),
|
||||
PlanetItemExchange("플래닛 아이템 교환"),
|
||||
|
||||
// IgmApi (전체 도메인이 누락됨)
|
||||
IgmApi("IgmApi"),
|
||||
BattleSnapshot("전투 스냅샷");
|
||||
|
||||
private final String description;
|
||||
|
||||
@@ -43,11 +43,11 @@ public class BusinessLogGenericService extends BusinessLogServiceBase {
|
||||
|
||||
// public List<Map<String, Object>> loadBusinessLogData(LogGenericRequest logGenericRequest) {
|
||||
public <T> List<T> loadBusinessLogData(LogGenericRequest logGenericRequest, Class<T> class1, boolean isSimple) {
|
||||
LocalDateTime startDt = logGenericRequest.getStartDt().plusHours(9);
|
||||
LocalDateTime endDt = logGenericRequest.getEndDt().plusHours(9).plusDays(1);
|
||||
// LocalDateTime startDt = logGenericRequest.getStartDt().plusHours(9);
|
||||
// LocalDateTime endDt = logGenericRequest.getEndDt().plusHours(9).plusDays(1);
|
||||
|
||||
String startTime = startDt.toString().substring(0, 10);
|
||||
String endTime = endDt.toString().substring(0, 10);
|
||||
String startTime = logGenericRequest.getStartDt().toString().substring(0, 10);
|
||||
String endTime = logGenericRequest.getEndDt().toString().substring(0, 10);
|
||||
LogAction logAction = logGenericRequest.getLogAction();
|
||||
LogDomain logDomain = logGenericRequest.getLogDomain();
|
||||
SearchUserType searchUserType = logGenericRequest.getSearchType();
|
||||
@@ -56,50 +56,20 @@ public class BusinessLogGenericService extends BusinessLogServiceBase {
|
||||
List<LogGenericRequest.LogFilter> filters = logGenericRequest.getFilters();
|
||||
|
||||
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);
|
||||
|
||||
if(activeProfile.equals("local") || activeProfile.equals("dev")) {
|
||||
//message json parsing
|
||||
operations.add(context ->
|
||||
new Document("$addFields",
|
||||
new Document("parseMessage",
|
||||
new Document("$function",
|
||||
new Document("body", "function(jsonString) { try { return JSON.parse(jsonString); } catch(e) { return {}; } }")
|
||||
.append("args", Arrays.asList("$message"))
|
||||
.append("lang", "js")
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
}else {
|
||||
|
||||
operations.add(context ->
|
||||
new Document("$addFields",
|
||||
new Document("parseMessage",
|
||||
new Document("$convert",
|
||||
new Document("input", "$message")
|
||||
.append("to", "object")
|
||||
.append("onError", new Document())
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
operations.add(context ->
|
||||
new Document("$addFields",
|
||||
new Document("header","$parseMessage.Header")
|
||||
.append("body","$parseMessage.Body")
|
||||
)
|
||||
);
|
||||
|
||||
if(logAction != null && !logAction.equals(LogAction.None)) {
|
||||
operations.add(context ->
|
||||
new Document("$match",
|
||||
new Document(AdminConstants.MONGO_DB_KEY_ACTION, logAction.name())
|
||||
)
|
||||
);
|
||||
}
|
||||
// if(logAction != null && !logAction.equals(LogAction.None)) {
|
||||
// operations.add(context ->
|
||||
// new Document("$match",
|
||||
// new Document(AdminConstants.MONGO_DB_KEY_ACTION, logAction.name())
|
||||
// )
|
||||
// );
|
||||
// }
|
||||
|
||||
if(logDomain != null && !logDomain.equals(LogDomain.BASE)) {
|
||||
operations.add(context ->
|
||||
|
||||
@@ -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.dynamodb.domain.DocAttributeHandler;
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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.history.entity.DBType;
|
||||
import com.caliverse.admin.mongodb.entity.DBType;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class DataInitializeHistoryBase implements historyLog {
|
||||
public class DataInitializeHistoryBase {
|
||||
|
||||
private DBType dbType;
|
||||
private String timestamp;
|
||||
private EInitDataType initDataType;
|
||||
private String tableName;
|
||||
private String tranId;
|
||||
private boolean isSuccess;
|
||||
private String message;
|
||||
|
||||
public DataInitializeHistoryBase(DBType dbType,
|
||||
String timestamp,
|
||||
EInitDataType initDataType,
|
||||
String tableName,
|
||||
String tranId,
|
||||
boolean isSuccess,
|
||||
String message
|
||||
) {
|
||||
this.dbType = dbType;
|
||||
this.timestamp = timestamp;
|
||||
this.initDataType = initDataType;
|
||||
this.tableName = tableName;
|
||||
this.tranId = tranId;
|
||||
this.isSuccess = isSuccess;
|
||||
this.message = message;
|
||||
}
|
||||
@@ -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.dynamodb.domain.doc.DynamoDBDocBase;
|
||||
import com.caliverse.admin.global.common.utils.DateUtils;
|
||||
import com.caliverse.admin.history.entity.DBType;
|
||||
import com.caliverse.admin.mongodb.entity.DBType;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.springframework.data.mongodb.core.mapping.Document;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Document(collection = "dataInitHistory")
|
||||
@Document(collection = "apiLog")
|
||||
public class DynamodbDataInitializeHistory extends DataInitializeHistoryBase {
|
||||
|
||||
private DynamoDBDocBase data;
|
||||
@@ -20,12 +17,11 @@ public class DynamodbDataInitializeHistory extends DataInitializeHistoryBase {
|
||||
|
||||
public DynamodbDataInitializeHistory(EInitDataType initDataType,
|
||||
String tableName,
|
||||
String tranId,
|
||||
boolean isSuccess,
|
||||
String message,
|
||||
DynamoDBDocBase data,
|
||||
String key) {
|
||||
super(DBType.DYNAMODB, DateUtils.nowDateTime(), initDataType, tableName, tranId, isSuccess, message);
|
||||
super(DBType.DYNAMODB, initDataType, tableName, isSuccess, message);
|
||||
|
||||
this.data = data;
|
||||
this.key = key;
|
||||
@@ -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.entity.HISTORYTYPE;
|
||||
import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
|
||||
import com.caliverse.admin.dynamodb.domain.doc.DynamoDBDocBase;
|
||||
import com.caliverse.admin.global.common.utils.DateUtils;
|
||||
import com.caliverse.admin.history.entity.DBType;
|
||||
import com.caliverse.admin.history.entity.EDBOperationType;
|
||||
import com.caliverse.admin.mongodb.entity.DBType;
|
||||
import com.caliverse.admin.mongodb.entity.EDBOperationType;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.springframework.data.mongodb.core.mapping.Document;
|
||||
@@ -19,8 +19,8 @@ public class DynamodbHistoryLogInfo extends HistoryLogInfoBase {
|
||||
|
||||
private DynamoDBDocBase data;
|
||||
|
||||
public DynamodbHistoryLogInfo(EDBOperationType operationType, HISTORYTYPE 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);
|
||||
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);
|
||||
|
||||
this.data = data;
|
||||
}
|
||||
@@ -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.entity.HISTORYTYPE;
|
||||
import com.caliverse.admin.history.entity.DBType;
|
||||
import com.caliverse.admin.history.entity.EDBOperationType;
|
||||
import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
|
||||
import com.caliverse.admin.mongodb.entity.DBType;
|
||||
import com.caliverse.admin.mongodb.entity.EDBOperationType;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class HistoryLogInfoBase implements historyLog {
|
||||
|
||||
private DBType dbType;
|
||||
private String timestamp;
|
||||
private EDBOperationType operationType;
|
||||
private HISTORYTYPE historyType;
|
||||
private HISTORYTYPEDETAIL historyType;
|
||||
private String tableName;
|
||||
private String message;
|
||||
private String TranId;
|
||||
private String tranId;
|
||||
private List<FieldChange> changed;
|
||||
private String userId;
|
||||
private String userIP;
|
||||
@@ -27,10 +29,10 @@ public class HistoryLogInfoBase implements historyLog {
|
||||
public HistoryLogInfoBase(DBType dbType,
|
||||
String timestamp,
|
||||
EDBOperationType operationType,
|
||||
HISTORYTYPE historyType,
|
||||
HISTORYTYPEDETAIL historyType,
|
||||
String tableName,
|
||||
String message,
|
||||
String TranId,
|
||||
String tranId,
|
||||
List<FieldChange> changed,
|
||||
String userId,
|
||||
String userIP
|
||||
@@ -41,7 +43,7 @@ public class HistoryLogInfoBase implements historyLog {
|
||||
this.historyType = historyType;
|
||||
this.tableName = tableName;
|
||||
this.message = message;
|
||||
this.TranId = TranId;
|
||||
this.tranId = tranId;
|
||||
this.changed = changed;
|
||||
this.userId = userId;
|
||||
this.userIP = userIP;
|
||||
@@ -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.global.common.utils.DateUtils;
|
||||
import com.caliverse.admin.history.entity.DBType;
|
||||
import com.caliverse.admin.mongodb.entity.DBType;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.springframework.data.mongodb.core.mapping.Document;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Document(collection = "dataInitHistory")
|
||||
@Document(collection = "apiLog")
|
||||
public class MysqlDataInitializeHistory extends DataInitializeHistoryBase {
|
||||
|
||||
private Object data;
|
||||
|
||||
public MysqlDataInitializeHistory(EInitDataType initDataType,
|
||||
String tableName,
|
||||
String TranId,
|
||||
boolean isSuccess,
|
||||
String message,
|
||||
Object data) {
|
||||
super(DBType.MYSQL, DateUtils.nowDateTime(), initDataType, tableName, TranId, isSuccess, message);
|
||||
super(DBType.MYSQL, initDataType, tableName, isSuccess, message);
|
||||
|
||||
this.data = data;
|
||||
}
|
||||
@@ -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.entity.HISTORYTYPE;
|
||||
import com.caliverse.admin.domain.entity.HISTORYTYPEDETAIL;
|
||||
import com.caliverse.admin.global.common.utils.DateUtils;
|
||||
import com.caliverse.admin.history.entity.DBType;
|
||||
import com.caliverse.admin.history.entity.EDBOperationType;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||
import com.caliverse.admin.mongodb.entity.DBType;
|
||||
import com.caliverse.admin.mongodb.entity.EDBOperationType;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
import org.springframework.data.mongodb.core.mapping.Document;
|
||||
|
||||
import java.util.List;
|
||||
@@ -22,8 +18,8 @@ public class MysqlHistoryLogInfo extends HistoryLogInfoBase {
|
||||
|
||||
private Object data;
|
||||
|
||||
public MysqlHistoryLogInfo(EDBOperationType operationType, HISTORYTYPE 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);
|
||||
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);
|
||||
|
||||
this.data = data;
|
||||
// this.data = deepCopy(data);
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.caliverse.admin.mongodb.domain;
|
||||
|
||||
public interface apiLog {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.caliverse.admin.mongodb.domain;
|
||||
|
||||
public interface historyLog {
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.caliverse.admin.history.entity;
|
||||
package com.caliverse.admin.mongodb.entity;
|
||||
|
||||
public enum DBType {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.caliverse.admin.history.entity;
|
||||
package com.caliverse.admin.mongodb.entity;
|
||||
|
||||
public enum EDBOperationType {
|
||||
|
||||
@@ -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> {
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
public interface DynamodbDataInitializeHistoryRepository extends MongoRepository<DynamodbDataInitializeHistory, String> {
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user