전투시스템 중지 처리

This commit is contained in:
2025-02-20 11:14:41 +09:00
parent 255c2e13c9
commit c50a26743a
8 changed files with 179 additions and 19 deletions

View File

@@ -133,6 +133,15 @@ public class BattleEventService {
.build();
}
// 일자만 필요해서 UTC시간으로 변경되다보니 한국시간(+9)을 더해서 마지막시간으로 설정
LocalDateTime end_dt_kst = battleEventRequest.getEventEndDt()
.plusHours(9)
.withHour(23)
.withMinute(59)
.withSecond(59)
.withNano(0);
battleEventRequest.setEventEndDt(end_dt_kst);
int next_event_id = dynamodbBattleEventService.getEventId() + 1;
battleEventRequest.setEventId(next_event_id);
@@ -181,6 +190,15 @@ public class BattleEventService {
.build();
}
List<BattleEvent> existingList = battleMapper.getCheckBattleEventList(battleEventRequest);
boolean isTime = isTimeOverlapping(existingList, battleEventRequest);
if(isTime){
return BattleEventResponse.builder()
.status(CommonCode.ERROR.getHttpStatus())
.result(ErrorCode.ERROR_BATTLE_EVENT_TIME_OVER.toString())
.build();
}
int result = battleMapper.updateBattleEvent(battleEventRequest);
log.info("AdminToolDB BattleEvent Update Complete: {}", battleEventRequest);
@@ -199,7 +217,50 @@ public class BattleEventService {
CommonUtils.getClientIp()
);
// dynamodbLandAuctionService.updateLandAuction(landRequest);
dynamodbBattleEventService.updateBattleEvent(battleEventRequest);
return BattleEventResponse.builder()
.resultData(BattleEventResponse.ResultData.builder()
.build())
.status(CommonCode.SUCCESS.getHttpStatus())
.result(CommonCode.SUCCESS.getResult())
.build();
}
@Transactional(transactionManager = "transactionManager")
public BattleEventResponse updateStopBattleEvent(Long id, BattleEventRequest battleEventRequest){
Map<String,Object> map = new HashMap<>();
BattleEvent info = battleMapper.getBattleEventDetail(id);
if(info.getStatus().equals(BattleEvent.BATTLE_STATUS.RUNNING)){
return BattleEventResponse.builder()
.status(CommonCode.ERROR.getHttpStatus())
.result(ErrorCode.ERROR_BATTLE_EVENT_STATUS_START_IMPOSSIBLE.toString())
.build();
}
map.put("id", id);
map.put("status", BattleEvent.BATTLE_STATUS.STOP);
map.put("updateBy", CommonUtils.getAdmin().getId());
int result = battleMapper.updateStatusBattleEvent(map);
try{
log.info("BattleEvent Stop Complete: {}", objectMapper.writeValueAsString(info));
}catch(Exception e){
log.error("BattleEvent Stop Failed: {}", e.getMessage());
}
mysqlHistoryLogService.updateHistoryLog(
HISTORYTYPE.BATTLE_EVENT_UPDATE,
MysqlConstants.TABLE_NAME_BATTLE_EVENT,
HISTORYTYPE.BATTLE_EVENT_UPDATE.name(),
info,
battleMapper.getBattleEventDetail(id),
CommonUtils.getAdmin().getEmail(),
CommonUtils.getClientIp()
);
dynamodbBattleEventService.updateStopBattleEvent(info);
return BattleEventResponse.builder()
.resultData(BattleEventResponse.ResultData.builder()
@@ -219,7 +280,7 @@ public class BattleEventService {
Long id = item.getId();
BattleEvent info = battleMapper.getBattleEventDetail(id);
if(!info.getStatus().equals(LandAuction.AUCTION_STATUS.WAIT) && !info.getStatus().equals(LandAuction.AUCTION_STATUS.RESV_START)){
if(!info.getStatus().equals(BattleEvent.BATTLE_STATUS.STOP)){
is_falil.set(true);
return;
}