From e8e49640deb2e796b4231af77f602ee549bd72d4 Mon Sep 17 00:00:00 2001 From: bcjang Date: Fri, 23 May 2025 16:00:05 +0900 Subject: [PATCH] =?UTF-8?q?=EA=B3=B5=EC=A7=80=20=EC=A0=95=EB=A0=AC=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20=ED=9E=88=EC=8A=A4=ED=86=A0=EB=A6=AC=20cal?= =?UTF-8?q?iverse=5Fmeta=5Fdata=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/domain/response/CaliumResponse.java | 1 + .../admin/domain/service/AdminService.java | 73 +++++++---------- .../admin/domain/service/CaliumService.java | 41 +++++++--- .../admin/domain/service/EventService.java | 14 ---- .../admin/domain/service/GroupService.java | 2 +- .../admin/domain/service/HistoryService.java | 51 ------------ .../admin/domain/service/LandService.java | 11 --- .../admin/domain/service/LogService.java | 6 ++ .../admin/domain/service/NoticeService.java | 19 ----- .../common/constants/MysqlConstants.java | 1 + .../admin/logs/entity/LogAction.java | 19 +++++ .../admin/logs/entity/LogDomain.java | 10 +++ .../BusinessLogGenericService.java | 8 +- .../polling/service/NoticeScheduler.java | 78 +++++++++++++++++++ src/main/resources/mappers/HistoryMapper.xml | 7 -- src/main/resources/mappers/NoticeMapper.xml | 4 +- 16 files changed, 182 insertions(+), 163 deletions(-) create mode 100644 src/main/java/com/caliverse/admin/scheduler/polling/service/NoticeScheduler.java diff --git a/src/main/java/com/caliverse/admin/domain/response/CaliumResponse.java b/src/main/java/com/caliverse/admin/domain/response/CaliumResponse.java index 162405c..e4a05e6 100644 --- a/src/main/java/com/caliverse/admin/domain/response/CaliumResponse.java +++ b/src/main/java/com/caliverse/admin/domain/response/CaliumResponse.java @@ -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; } diff --git a/src/main/java/com/caliverse/admin/domain/service/AdminService.java b/src/main/java/com/caliverse/admin/domain/service/AdminService.java index af0c852..286f02e 100644 --- a/src/main/java/com/caliverse/admin/domain/service/AdminService.java +++ b/src/main/java/com/caliverse/admin/domain/service/AdminService.java @@ -11,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; @@ -37,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; @@ -170,8 +173,9 @@ public class AdminService { Map map = new HashMap<>(); adminRequest.getList().forEach( item -> { - - map.put("email", item.getEmail()); + String email = item.getEmail(); + Optional info = adminMapper.findByEmail(email); + map.put("email", email); map.put("id", CommonUtils.getAdmin().getId()); if(item.getIsApprove().equals(AdminRequest.Approve.APPROVE)){ @@ -184,18 +188,13 @@ public class AdminService { //로그인 승인 adminMapper.updateStatus(map); - //로그 기록 - Optional 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(HISTORYTYPEDETAIL.LOGIN_PERMITTED, jsonObject); + mysqlHistoryLogService.updateHistoryLog( + HISTORYTYPEDETAIL.LOGIN_PERMITTED, + MysqlConstants.TABLE_NAME_ADMIN, + HISTORYTYPEDETAIL.LOGIN_PERMITTED.name(), + info.get(), + adminMapper.findByEmail(email) + ); } ); @@ -214,32 +213,24 @@ public class AdminService { Map 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 = adminMapper.findByEmail(item.getEmail()); + Optional info = adminMapper.findByEmail(email); - Map beforeGroup = groupMapper.getGroupInfo(admin.get().getGroupId()); //쿼리 실행 adminMapper.updateGroup(map); - //로그 기록 - //변경후 그룹 명세 조회 - Map 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(HISTORYTYPEDETAIL.ADMIN_INFO_UPDATE, jsonObject); + mysqlHistoryLogService.updateHistoryLog( + HISTORYTYPEDETAIL.ADMIN_INFO_UPDATE, + MysqlConstants.TABLE_NAME_ADMIN, + HISTORYTYPEDETAIL.ADMIN_INFO_UPDATE.name(), + info.get(), + adminMapper.findByEmail(email) + ); } ); @@ -260,21 +251,17 @@ public class AdminService { map.put("email", item.getEmail()); map.put("deleted", String.valueOf(1)); //로그 기록 - Optional admin = adminMapper.findByEmail(item.getEmail()); + Optional 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(HISTORYTYPEDETAIL.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); diff --git a/src/main/java/com/caliverse/admin/domain/service/CaliumService.java b/src/main/java/com/caliverse/admin/domain/service/CaliumService.java index 4d72358..86babd6 100644 --- a/src/main/java/com/caliverse/admin/domain/service/CaliumService.java +++ b/src/main/java/com/caliverse/admin/domain/service/CaliumService.java @@ -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,6 +18,9 @@ import com.caliverse.admin.global.common.code.SuccessCode; import com.caliverse.admin.global.common.constants.MysqlConstants; import com.caliverse.admin.global.common.constants.Web3Constants; import com.caliverse.admin.global.common.utils.CommonUtils; +import com.caliverse.admin.logs.Indicatordomain.GenericMongoLog; +import com.caliverse.admin.logs.entity.LogAction; +import com.caliverse.admin.logs.logservice.businesslogservice.BusinessLogGenericService; import com.caliverse.admin.mongodb.service.MysqlHistoryLogService; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -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 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 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() @@ -153,13 +167,6 @@ public class CaliumService { calium ); - //로그 기록 - JSONObject jsonObject = new JSONObject(); - jsonObject.put("dept",caliumRequest.getDept()); - jsonObject.put("count",caliumRequest.getCount()); - jsonObject.put("content",caliumRequest.getContent()); - historyService.setLog(HISTORYTYPEDETAIL.CALIUM_ADD, jsonObject); - return CaliumResponse.builder() .status(CommonCode.SUCCESS.getHttpStatus()) .result(CommonCode.SUCCESS.getResult()) @@ -173,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()) @@ -186,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(HISTORYTYPEDETAIL.CALIUM_TOTAL_UPDATE, jsonObject); +// historyService.setLog(HISTORYTYPEDETAIL.CALIUM_TOTAL_UPDATE, jsonObject); return CaliumResponse.builder() .status(CommonCode.SUCCESS.getHttpStatus()) diff --git a/src/main/java/com/caliverse/admin/domain/service/EventService.java b/src/main/java/com/caliverse/admin/domain/service/EventService.java index 5fae490..1e06300 100644 --- a/src/main/java/com/caliverse/admin/domain/service/EventService.java +++ b/src/main/java/com/caliverse/admin/domain/service/EventService.java @@ -225,20 +225,6 @@ public class EventService { 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 = eventMapper.getMessage(item.getId()); - if(!message.isEmpty()){ - jsonObject.put("message",message.get(0).getTitle()); - } - historyService.setLog(HISTORYTYPEDETAIL.EVENT_DELETE, jsonObject); } ); diff --git a/src/main/java/com/caliverse/admin/domain/service/GroupService.java b/src/main/java/com/caliverse/admin/domain/service/GroupService.java index 033f8e7..2885138 100644 --- a/src/main/java/com/caliverse/admin/domain/service/GroupService.java +++ b/src/main/java/com/caliverse/admin/domain/service/GroupService.java @@ -85,7 +85,7 @@ public class GroupService { //권한 그룹 등록 public GroupResponse postAdminGroup(GroupRequest groupRequest){ - List authList = Arrays.asList(1, 5, 6, 9, 10, 11, 13, 14, 15, 16, 19, 22, 24, 26, 32); //그룹 초기 권한 + List authList = Arrays.asList(1, 5, 6, 9, 10, 11, 13, 14, 15, 16, 19, 22, 24, 26, 32, 36, 41,46, 49); //그룹 초기 권한 Map map = new HashMap<>(); groupRequest.setCreateBy(CommonUtils.getAdmin().getId()); diff --git a/src/main/java/com/caliverse/admin/domain/service/HistoryService.java b/src/main/java/com/caliverse/admin/domain/service/HistoryService.java index c3c0386..ec8bda4 100644 --- a/src/main/java/com/caliverse/admin/domain/service/HistoryService.java +++ b/src/main/java/com/caliverse/admin/domain/service/HistoryService.java @@ -107,57 +107,6 @@ 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 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(HISTORYTYPEDETAIL type, JSONObject content){ - //로그 기록 - Map 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(HISTORYTYPEDETAIL type, String message){ //스케줄 로그 기록 Map logMap = new HashMap<>(); diff --git a/src/main/java/com/caliverse/admin/domain/service/LandService.java b/src/main/java/com/caliverse/admin/domain/service/LandService.java index ebc1056..3618c82 100644 --- a/src/main/java/com/caliverse/admin/domain/service/LandService.java +++ b/src/main/java/com/caliverse/admin/domain/service/LandService.java @@ -627,17 +627,6 @@ public class LandService { ); dynamodbLandAuctionService.cancelLandAuction(auction_info); - - JSONObject jsonObject = new JSONObject(); - - //로그 기록 - List 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(HISTORYTYPEDETAIL.LAND_AUCTION_DELETE, jsonObject); } ); diff --git a/src/main/java/com/caliverse/admin/domain/service/LogService.java b/src/main/java/com/caliverse/admin/domain/service/LogService.java index ad905fb..59631ee 100644 --- a/src/main/java/com/caliverse/admin/domain/service/LogService.java +++ b/src/main/java/com/caliverse/admin/domain/service/LogService.java @@ -11,6 +11,7 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.data.mongodb.UncategorizedMongoDbException; import org.springframework.stereotype.Service; +import java.time.LocalDateTime; import java.util.*; import java.util.stream.Collectors; @@ -31,6 +32,11 @@ public class LogService { // logGenericRequest.setEndDt(endDt); // List> 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 logList = new ArrayList<>(); try{ logList = businessLogGenericService.loadBusinessLogData(logGenericRequest, GenericMongoLog.class); diff --git a/src/main/java/com/caliverse/admin/domain/service/NoticeService.java b/src/main/java/com/caliverse/admin/domain/service/NoticeService.java index d640c78..fb68d1b 100644 --- a/src/main/java/com/caliverse/admin/domain/service/NoticeService.java +++ b/src/main/java/com/caliverse/admin/domain/service/NoticeService.java @@ -105,16 +105,6 @@ public class NoticeService { noticeMapper.getNoticeDetail(noticeRequest.getId()) ); - //로그 기록 -// JSONObject jsonObject = new JSONObject(); -// jsonObject.put("message_type",noticeRequest.getMessageType()); -// jsonObject.put("repeat_type",noticeRequest.getRepeatType()); -// jsonObject.put("repeat_cnt",noticeRequest.getRepeatCnt()); -// jsonObject.put("repeat_dt",noticeRequest.getRepeatDt()); -// jsonObject.put("send_dt",noticeRequest.getSendDt()); -// jsonObject.put("end_dt",noticeRequest.getEndDt()); -// jsonObject.put("message",noticeRequest.getGameMessages().toString()); -// historyService.setLog(HISTORYTYPE.NOTICE_ADD, jsonObject); return NoticeResponse.builder() .resultData(NoticeResponse.ResultData.builder().message(SuccessCode.REGISTRATION.getMessage()).build()) @@ -196,15 +186,6 @@ public class NoticeService { noticeMapper.getNoticeDetail(item.getMessageId()) ); - //로그 기록 -// map.put("adminId", CommonUtils.getAdmin().getId()); -// map.put("name", CommonUtils.getAdmin().getName()); -// map.put("mail", CommonUtils.getAdmin().getEmail()); -// map.put("type", HISTORYTYPE.NOTICE_DELETE); -// JSONObject jsonObject = new JSONObject(); -// jsonObject.put("message",message); -// map.put("content",jsonObject.toString()); -// historyMapper.saveLog(map); } ); log.info("deleteInGameMessage notice: {}", noticeRequest); diff --git a/src/main/java/com/caliverse/admin/global/common/constants/MysqlConstants.java b/src/main/java/com/caliverse/admin/global/common/constants/MysqlConstants.java index 6cc898e..2427b1f 100644 --- a/src/main/java/com/caliverse/admin/global/common/constants/MysqlConstants.java +++ b/src/main/java/com/caliverse/admin/global/common/constants/MysqlConstants.java @@ -5,6 +5,7 @@ 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"; diff --git a/src/main/java/com/caliverse/admin/logs/entity/LogAction.java b/src/main/java/com/caliverse/admin/logs/entity/LogAction.java index 9001cbc..46d0cc5 100644 --- a/src/main/java/com/caliverse/admin/logs/entity/LogAction.java +++ b/src/main/java/com/caliverse/admin/logs/entity/LogAction.java @@ -215,6 +215,25 @@ public enum LogAction { UserLogout("유저 로그아웃"), UserLogoutSnapShot("게임 로그아웃 스냅샷"), UserReport("유저 신고"), + ItemDestroyByUser("아이템 제거 (사용자에 의해)"), + ItemDestoryByExpiration("아이템 제거 (기간만료에 의해)"), + + // 퀘스트 관련 + QuestMainAssign("퀘스트 메인 수락"), + + // 비컨 상점 관련 + BeaconShopRegisterItem("비컨 상점에 아이템 등록"), + BeaconShopReturnItem("비컨 상점 아이템 회수"), + BeaconShopPurchaseItem("비컨 상점에서 아이템 구매"), + BeaconShopReceivePaymentForSales("비컨 상점 판매한 아이템 정산 받기"), + BeaconShopSearchItem("비컨 상점 아이템 검색"), + BeaconShopUpdateDailyCount("비컨 상점 하루 제한 업데이트"), + BeaconShopDeleteRecord("비컨 상점 기록 영수증 제거"), + BeaconShopDeactiveItems("비컨 상점 아이템 비활성화"), + + // 치트 명령어 관련 + CheatCommandBeaconShopItemTimeChange("치트로 인한 비컨 상점 시간 변경"), + CheatCommandDailyLimitInit("치트로 인한 비컨 상점 일일 횟수 초기화"), Warp("워프"); diff --git a/src/main/java/com/caliverse/admin/logs/entity/LogDomain.java b/src/main/java/com/caliverse/admin/logs/entity/LogDomain.java index 8c849e2..3423c14 100644 --- a/src/main/java/com/caliverse/admin/logs/entity/LogDomain.java +++ b/src/main/java/com/caliverse/admin/logs/entity/LogDomain.java @@ -74,6 +74,16 @@ public enum LogDomain { BattleRoomJoin("전투 입장"), BattleDead("전투 죽음"), BattleRound("전투 라운드"), + BeaconShopSoldRecord("비컨 상점 영수증"), + BeaconShopSoldPrice("비컨 상점 정산금"), + + // BrokerApi 하위 도메인들 + PlanetProviderAuth("플래닛 컨텐츠 제공자 인증"), + PlanetUserAuth("플래닛 유저 인증"), + PlanetItemExchange("플래닛 아이템 교환"), + + // IgmApi (전체 도메인이 누락됨) + IgmApi("IgmApi"), BattleSnapshot("전투 스냅샷"); private final String description; diff --git a/src/main/java/com/caliverse/admin/logs/logservice/businesslogservice/BusinessLogGenericService.java b/src/main/java/com/caliverse/admin/logs/logservice/businesslogservice/BusinessLogGenericService.java index 35a6df2..f5946c2 100644 --- a/src/main/java/com/caliverse/admin/logs/logservice/businesslogservice/BusinessLogGenericService.java +++ b/src/main/java/com/caliverse/admin/logs/logservice/businesslogservice/BusinessLogGenericService.java @@ -43,11 +43,11 @@ public class BusinessLogGenericService extends BusinessLogServiceBase { // public List> loadBusinessLogData(LogGenericRequest logGenericRequest) { public List loadBusinessLogData(LogGenericRequest logGenericRequest, Class 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(); diff --git a/src/main/java/com/caliverse/admin/scheduler/polling/service/NoticeScheduler.java b/src/main/java/com/caliverse/admin/scheduler/polling/service/NoticeScheduler.java new file mode 100644 index 0000000..115fba8 --- /dev/null +++ b/src/main/java/com/caliverse/admin/scheduler/polling/service/NoticeScheduler.java @@ -0,0 +1,78 @@ +package com.caliverse.admin.scheduler.polling.service; + +import com.caliverse.admin.domain.entity.LandOwnerChange; +import com.caliverse.admin.domain.request.LandRequest; +import com.caliverse.admin.domain.service.LandService; +import com.caliverse.admin.domain.service.UserGameSessionService; +import com.caliverse.admin.dynamodb.service.DynamodbLandService; +import com.caliverse.admin.dynamodb.service.DynamodbMailService; +import com.caliverse.admin.scheduler.CommonScheduler; +import com.caliverse.admin.scheduler.entity.SchedulerType; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import java.time.LocalDateTime; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Slf4j +@Component +public class NoticeScheduler extends CommonScheduler { + + private final LandService landService; + private final DynamodbLandService dynamodbLandService; + private final DynamodbMailService dynamodbMailService; + private final UserGameSessionService userGameSessionService; + + public NoticeScheduler(LandService landService, DynamodbLandService dynamodbLandService, DynamodbMailService dynamodbMailService, UserGameSessionService userGameSessionService) { + this.landService = landService; + this.dynamodbLandService = dynamodbLandService; + this.dynamodbMailService = dynamodbMailService; + this.userGameSessionService = userGameSessionService; + } + + @Override + protected void executeInternal() { + List scheduleList = landService.getScheduleLandOwnerChangesList(); + + scheduleList.forEach(landOwnerChange -> { + LandOwnerChange.CHANGE_STATUS status = landOwnerChange.getStatus(); + LocalDateTime reserve_dt = landOwnerChange.getReservationDt(); + int landId = landOwnerChange.getLandId(); + String guid = landOwnerChange.getUserGuid(); + + LocalDateTime now = LocalDateTime.now(); + + if(status.equals(LandOwnerChange.CHANGE_STATUS.WAIT) && reserve_dt.isBefore(now)) { + LandRequest landRequest = LandRequest.builder() + .landId(landId) + .landName(landOwnerChange.getLandName()) + .buildingId(landOwnerChange.getBuildingId()) + .buildingName(landOwnerChange.getBuildingName()) + .userGuid(guid) + .userName(landOwnerChange.getUserName()) + .build(); + + //유저킥 + userGameSessionService.kickUserSession(guid, "land owner changes"); + + //랜드정보 처리 + dynamodbLandService.ChangesLandOwner(landRequest); + + Map map = new HashMap<>(); + map.put("id", landOwnerChange.getId()); + map.put("status", LandOwnerChange.CHANGE_STATUS.FINISH); + landService.updateLandOwnedChangeStatus(map); + + //우편 + dynamodbMailService.insertLandChangesMail(landRequest); + } + }); + } + + @Override + public SchedulerType getSchedulerType() { + return SchedulerType.LAND_OWNER_CHANGES; + } +} diff --git a/src/main/resources/mappers/HistoryMapper.xml b/src/main/resources/mappers/HistoryMapper.xml index 40da217..4a12f14 100644 --- a/src/main/resources/mappers/HistoryMapper.xml +++ b/src/main/resources/mappers/HistoryMapper.xml @@ -92,12 +92,5 @@ INSERT INTO admin_log (admin_id,name,mail,type,content) VALUES (#{adminId},#{name},#{mail}, #{type}, #{content}); - - TRUNCATE TABLE caliverse_meta_data - - - - INSERT INTO caliverse_meta_data (file_name, data_id, json_data) VALUES (#{fileName}, #{dataId}, #{jsonData}) - diff --git a/src/main/resources/mappers/NoticeMapper.xml b/src/main/resources/mappers/NoticeMapper.xml index 31c94c3..3118968 100644 --- a/src/main/resources/mappers/NoticeMapper.xml +++ b/src/main/resources/mappers/NoticeMapper.xml @@ -59,8 +59,10 @@ LEFT JOIN admin c ON(a.create_by = c.email) WHERE 1 = 1 AND a.deleted = 0 - GROUP BY a.id) d + GROUP BY a.id + ORDER BY a.create_dt) d , (SELECT @row_number:=0) AS t + ORDER BY row_num desc