이용자 제재 스케줄 처리 수정
This commit is contained in:
@@ -179,32 +179,56 @@ public class DynamicScheduler {
|
||||
List<BlackList> blackList = blackListService.getScheduleBlackList();
|
||||
|
||||
try{
|
||||
LocalDateTime nowDate = LocalDateTime.now();
|
||||
blackList.forEach(blockUser -> {
|
||||
LocalDateTime nowDate = LocalDateTime.now();
|
||||
LocalDateTime startTime = blockUser.getStartDt();
|
||||
LocalDateTime endTime = blockUser.getEndDt();
|
||||
BlackList.STATUSTYPE status = blockUser.getStatus();
|
||||
|
||||
// 이미 지난시간이면 fail 처리
|
||||
if(nowDate.isAfter(endTime) && blockUser.getStatus().equals(BlackList.STATUSTYPE.WAIT)){
|
||||
blackListService.updateBlackListStatus(blockUser.getId(), BlackList.STATUSTYPE.FAIL);
|
||||
log.error("blackListJob blackListSchedule timeOut : {}", blockUser);
|
||||
return;
|
||||
// WAIT 상태 처리
|
||||
if(status == BlackList.STATUSTYPE.WAIT) {
|
||||
if(nowDate.isAfter(blockUser.getEndDt())) {
|
||||
// 만료시간 초과 - FAIL 처리
|
||||
blackListService.updateBlackListStatus(blockUser.getId(), BlackList.STATUSTYPE.FAIL);
|
||||
log.error("blackListJob blackListSchedule timeOut : {}", blockUser);
|
||||
} else if(!nowDate.isBefore(blockUser.getStartDt())) {
|
||||
// 시작시간 도달 - INPROGRESS 처리
|
||||
userGameSessionService.kickUserSession(blockUser.getGuid());
|
||||
blackListService.updateScheduleBlockUser(blockUser, BlackList.STATUSTYPE.INPROGRESS);
|
||||
blackListService.updateBlackListStatus(blockUser.getId(), BlackList.STATUSTYPE.INPROGRESS);
|
||||
log.info("blackListJob blackListSchedule block start : {}", blockUser);
|
||||
}
|
||||
}
|
||||
|
||||
// 시작시간 지났으면 정지 처리
|
||||
if(!nowDate.isBefore(startTime) && blockUser.getStatus().equals(BlackList.STATUSTYPE.WAIT)){
|
||||
// user kick 처리
|
||||
userGameSessionService.kickUserSession(blockUser.getGuid());
|
||||
blackListService.updateScheduleBlockUser(blockUser, BlackList.STATUSTYPE.INPROGRESS);
|
||||
blackListService.updateBlackListStatus(blockUser.getId(), BlackList.STATUSTYPE.INPROGRESS);
|
||||
log.info("blackListJob blackListSchedule block start : {}", blockUser);
|
||||
}
|
||||
|
||||
if(!nowDate.isBefore(endTime) && blockUser.getStatus().equals(BlackList.STATUSTYPE.INPROGRESS)){
|
||||
// INPROGRESS 상태 처리
|
||||
else if(status == BlackList.STATUSTYPE.INPROGRESS && !nowDate.isBefore(blockUser.getEndDt())) {
|
||||
// 만료시간 도달 - EXPIRATION 처리
|
||||
blackListService.updateScheduleBlockUser(blockUser, BlackList.STATUSTYPE.EXPIRATION);
|
||||
blackListService.updateBlackListStatus(blockUser.getId(), BlackList.STATUSTYPE.EXPIRATION);
|
||||
log.info("blackListJob blackListSchedule block end : {}", blockUser);
|
||||
}
|
||||
// LocalDateTime startTime = blockUser.getStartDt();
|
||||
// LocalDateTime endTime = blockUser.getEndDt();
|
||||
//
|
||||
// // 상태가 대기중이고 만료시간이 지났으면 실패 처리
|
||||
// if(nowDate.isAfter(endTime) && blockUser.getStatus().equals(BlackList.STATUSTYPE.WAIT)){
|
||||
// blackListService.updateBlackListStatus(blockUser.getId(), BlackList.STATUSTYPE.FAIL);
|
||||
// log.error("blackListJob blackListSchedule timeOut : {}", blockUser);
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// // 상태가 대기중이고 시작시간 지났으면 유저제재 처리
|
||||
// if(!nowDate.isBefore(startTime) && blockUser.getStatus().equals(BlackList.STATUSTYPE.WAIT)){
|
||||
// // user kick 처리
|
||||
// userGameSessionService.kickUserSession(blockUser.getGuid());
|
||||
// blackListService.updateScheduleBlockUser(blockUser, BlackList.STATUSTYPE.INPROGRESS);
|
||||
// blackListService.updateBlackListStatus(blockUser.getId(), BlackList.STATUSTYPE.INPROGRESS);
|
||||
// log.info("blackListJob blackListSchedule block start : {}", blockUser);
|
||||
// }
|
||||
//
|
||||
// // 상태가 제재중이고 만료시간 지났으면 상태 종료 처리
|
||||
// if(!nowDate.isBefore(endTime) && blockUser.getStatus().equals(BlackList.STATUSTYPE.INPROGRESS)){
|
||||
// blackListService.updateScheduleBlockUser(blockUser, BlackList.STATUSTYPE.EXPIRATION);
|
||||
// blackListService.updateBlackListStatus(blockUser.getId(), BlackList.STATUSTYPE.EXPIRATION);
|
||||
// log.info("blackListJob blackListSchedule block end : {}", blockUser);
|
||||
// }
|
||||
});
|
||||
}catch (Exception e){
|
||||
log.error("blackListSchedule Exception: {}", e.getMessage());
|
||||
|
||||
Reference in New Issue
Block a user