스케줄 aop 동작안함으로 구조 변경
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
package com.caliverse.admin.scheduler;
|
package com.caliverse.admin.scheduler;
|
||||||
|
|
||||||
|
import com.caliverse.admin.domain.entity.log.LogAction;
|
||||||
import com.caliverse.admin.domain.entity.log.LogStatus;
|
import com.caliverse.admin.domain.entity.log.LogStatus;
|
||||||
|
import com.caliverse.admin.global.component.manager.BusinessProcessIdManager;
|
||||||
import com.caliverse.admin.mongodb.service.BusinessLogService;
|
import com.caliverse.admin.mongodb.service.BusinessLogService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -13,9 +15,11 @@ import java.util.Map;
|
|||||||
public abstract class CommonScheduler implements Scheduler {
|
public abstract class CommonScheduler implements Scheduler {
|
||||||
|
|
||||||
protected final BusinessLogService businessLogService;
|
protected final BusinessLogService businessLogService;
|
||||||
|
protected final BusinessProcessIdManager processIdManager;
|
||||||
|
|
||||||
protected CommonScheduler(BusinessLogService businessLogService) {
|
protected CommonScheduler(BusinessLogService businessLogService, BusinessProcessIdManager processIdManager) {
|
||||||
this.businessLogService = businessLogService;
|
this.businessLogService = businessLogService;
|
||||||
|
this.processIdManager = processIdManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -46,4 +50,15 @@ public abstract class CommonScheduler implements Scheduler {
|
|||||||
* 스케줄러 구현체에서 실제 작업을 수행하는 메소드
|
* 스케줄러 구현체에서 실제 작업을 수행하는 메소드
|
||||||
*/
|
*/
|
||||||
protected abstract void executeInternal();
|
protected abstract void executeInternal();
|
||||||
|
|
||||||
|
protected void executeWithProcessId(LogAction action, Runnable businessLogic) {
|
||||||
|
processIdManager.createNewProcessId();
|
||||||
|
processIdManager.setCurrentAction(action);
|
||||||
|
|
||||||
|
try {
|
||||||
|
businessLogic.run();
|
||||||
|
} finally {
|
||||||
|
processIdManager.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import com.caliverse.admin.domain.entity.log.LogAction;
|
|||||||
import com.caliverse.admin.domain.entity.log.LogStatus;
|
import com.caliverse.admin.domain.entity.log.LogStatus;
|
||||||
import com.caliverse.admin.domain.service.BattleEventService;
|
import com.caliverse.admin.domain.service.BattleEventService;
|
||||||
import com.caliverse.admin.global.common.annotation.BusinessProcess;
|
import com.caliverse.admin.global.common.annotation.BusinessProcess;
|
||||||
|
import com.caliverse.admin.global.component.manager.BusinessProcessIdManager;
|
||||||
import com.caliverse.admin.mongodb.service.BusinessLogService;
|
import com.caliverse.admin.mongodb.service.BusinessLogService;
|
||||||
import com.caliverse.admin.scheduler.CommonScheduler;
|
import com.caliverse.admin.scheduler.CommonScheduler;
|
||||||
import com.caliverse.admin.scheduler.entity.SchedulerType;
|
import com.caliverse.admin.scheduler.entity.SchedulerType;
|
||||||
@@ -26,14 +27,18 @@ public class BattleEventScheduler extends CommonScheduler {
|
|||||||
private final BattleEventService battleEventService;
|
private final BattleEventService battleEventService;
|
||||||
|
|
||||||
public BattleEventScheduler(BattleEventService battleEventService,
|
public BattleEventScheduler(BattleEventService battleEventService,
|
||||||
BusinessLogService businessLogService) {
|
BusinessLogService businessLogService,
|
||||||
super(businessLogService);
|
BusinessProcessIdManager processIdManager) {
|
||||||
|
super(businessLogService, processIdManager);
|
||||||
this.battleEventService = battleEventService;
|
this.battleEventService = battleEventService;
|
||||||
}
|
}
|
||||||
|
|
||||||
@BusinessProcess(action = LogAction.SCHEDULE_BATTLE_EVENT)
|
|
||||||
@Override
|
@Override
|
||||||
protected void executeInternal() {
|
protected void executeInternal() {
|
||||||
|
executeWithProcessId(LogAction.SCHEDULE_BATTLE_EVENT, this::executeLogic);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void executeLogic(){
|
||||||
List<BattleEvent> eventList = battleEventService.getScheduleBattleEventList();
|
List<BattleEvent> eventList = battleEventService.getScheduleBattleEventList();
|
||||||
|
|
||||||
LocalDateTime startTime = LocalDateTime.now();
|
LocalDateTime startTime = LocalDateTime.now();
|
||||||
@@ -89,24 +94,33 @@ public class BattleEventScheduler extends CommonScheduler {
|
|||||||
eventIds.add(event.getId());
|
eventIds.add(event.getId());
|
||||||
processCount.incrementAndGet();
|
processCount.incrementAndGet();
|
||||||
}
|
}
|
||||||
}else if(status.equals(BattleEvent.BATTLE_STATUS.RUNNING) || status.equals(BattleEvent.BATTLE_STATUS.STOP)){
|
}else if(status.equals(BattleEvent.BATTLE_STATUS.RUNNING)){
|
||||||
if(!(!now.isBefore(todayStart) && !now.isAfter(todayEnd))){
|
if(!(!now.isBefore(todayStart) && !now.isAfter(todayEnd))){
|
||||||
if(!baseDate.isBefore(end_dt.toLocalDate())){
|
if(!baseDate.isBefore(end_dt.toLocalDate())){
|
||||||
change_status = BattleEvent.BATTLE_STATUS.END;
|
change_status = BattleEvent.BATTLE_STATUS.END;
|
||||||
processCount.incrementAndGet();
|
} else {
|
||||||
}else{
|
change_status = BattleEvent.BATTLE_STATUS.WAIT;
|
||||||
change_status = status.equals(BattleEvent.BATTLE_STATUS.STOP) ? BattleEvent.BATTLE_STATUS.STOP : BattleEvent.BATTLE_STATUS.WAIT;
|
|
||||||
if (change_status.equals(BattleEvent.BATTLE_STATUS.STOP)) {
|
|
||||||
processCount.incrementAndGet();
|
|
||||||
} else {
|
|
||||||
processCount.incrementAndGet();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
log.info("battle event_id: {}, start_dt: {}, end_dt: {}, todayStart: {}, todayEnd: {} STATUS CHANGE {}", event.getId(), start_dt, end_dt, todayStart, todayEnd, change_status);
|
|
||||||
|
log.info("battle event_id: {}, start_dt: {}, end_dt: {}, todayStart: {}, todayEnd: {} STATUS CHANGE {}",
|
||||||
|
event.getId(), start_dt, end_dt, todayStart, todayEnd, change_status);
|
||||||
map.put("status", change_status);
|
map.put("status", change_status);
|
||||||
battleEventService.updateBattleEventStatus(map);
|
battleEventService.updateBattleEventStatus(map);
|
||||||
|
|
||||||
eventIds.add(event.getId());
|
eventIds.add(event.getId());
|
||||||
|
processCount.incrementAndGet();
|
||||||
|
}
|
||||||
|
} else if(status.equals(BattleEvent.BATTLE_STATUS.STOP)){
|
||||||
|
if(!baseDate.isBefore(end_dt.toLocalDate())){
|
||||||
|
change_status = BattleEvent.BATTLE_STATUS.END;
|
||||||
|
|
||||||
|
log.info("battle event_id: {}, end_dt: {}, baseDate: {} STATUS CHANGE END (from STOP)",
|
||||||
|
event.getId(), end_dt, baseDate);
|
||||||
|
map.put("status", change_status);
|
||||||
|
battleEventService.updateBattleEventStatus(map);
|
||||||
|
|
||||||
|
eventIds.add(event.getId());
|
||||||
|
processCount.incrementAndGet();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.caliverse.admin.domain.entity.log.LogStatus;
|
|||||||
import com.caliverse.admin.domain.service.BlackListService;
|
import com.caliverse.admin.domain.service.BlackListService;
|
||||||
import com.caliverse.admin.domain.service.UserGameSessionService;
|
import com.caliverse.admin.domain.service.UserGameSessionService;
|
||||||
import com.caliverse.admin.global.common.annotation.BusinessProcess;
|
import com.caliverse.admin.global.common.annotation.BusinessProcess;
|
||||||
|
import com.caliverse.admin.global.component.manager.BusinessProcessIdManager;
|
||||||
import com.caliverse.admin.mongodb.service.BusinessLogService;
|
import com.caliverse.admin.mongodb.service.BusinessLogService;
|
||||||
import com.caliverse.admin.scheduler.CommonScheduler;
|
import com.caliverse.admin.scheduler.CommonScheduler;
|
||||||
import com.caliverse.admin.scheduler.entity.SchedulerType;
|
import com.caliverse.admin.scheduler.entity.SchedulerType;
|
||||||
@@ -27,15 +28,20 @@ public class BlackListScheduler extends CommonScheduler {
|
|||||||
|
|
||||||
public BlackListScheduler(UserGameSessionService userGameSessionService,
|
public BlackListScheduler(UserGameSessionService userGameSessionService,
|
||||||
BlackListService blackListService,
|
BlackListService blackListService,
|
||||||
BusinessLogService businessLogService) {
|
BusinessLogService businessLogService,
|
||||||
super(businessLogService);
|
BusinessProcessIdManager processIdManager) {
|
||||||
|
super(businessLogService, processIdManager);
|
||||||
this.userGameSessionService = userGameSessionService;
|
this.userGameSessionService = userGameSessionService;
|
||||||
this.blackListService = blackListService;
|
this.blackListService = blackListService;
|
||||||
}
|
}
|
||||||
|
|
||||||
@BusinessProcess(action = LogAction.SCHEDULE_BLACK_LIST)
|
|
||||||
@Override
|
@Override
|
||||||
protected void executeInternal() {
|
protected void executeInternal() {
|
||||||
|
executeWithProcessId(LogAction.SCHEDULE_BLACK_LIST, this::executeLogic);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void executeLogic() {
|
||||||
List<BlackList> blackList = blackListService.getScheduleBlackList();
|
List<BlackList> blackList = blackListService.getScheduleBlackList();
|
||||||
|
|
||||||
LocalDateTime startTime = LocalDateTime.now();
|
LocalDateTime startTime = LocalDateTime.now();
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import com.caliverse.admin.dynamodb.service.DynamodbLandAuctionService;
|
|||||||
import com.caliverse.admin.dynamodb.service.DynamodbLandService;
|
import com.caliverse.admin.dynamodb.service.DynamodbLandService;
|
||||||
import com.caliverse.admin.dynamodb.service.DynamodbService;
|
import com.caliverse.admin.dynamodb.service.DynamodbService;
|
||||||
import com.caliverse.admin.global.common.annotation.BusinessProcess;
|
import com.caliverse.admin.global.common.annotation.BusinessProcess;
|
||||||
|
import com.caliverse.admin.global.component.manager.BusinessProcessIdManager;
|
||||||
import com.caliverse.admin.mongodb.service.BusinessLogService;
|
import com.caliverse.admin.mongodb.service.BusinessLogService;
|
||||||
import com.caliverse.admin.scheduler.CommonScheduler;
|
import com.caliverse.admin.scheduler.CommonScheduler;
|
||||||
import com.caliverse.admin.scheduler.entity.SchedulerType;
|
import com.caliverse.admin.scheduler.entity.SchedulerType;
|
||||||
@@ -41,17 +42,21 @@ public class DataInitializeScheduler extends CommonScheduler {
|
|||||||
DynamodbDataService dynamodbDataService,
|
DynamodbDataService dynamodbDataService,
|
||||||
LandService landService,
|
LandService landService,
|
||||||
DynamodbLandAuctionService dynamodbLandAuctionService,
|
DynamodbLandAuctionService dynamodbLandAuctionService,
|
||||||
BusinessLogService businessLogService) {
|
BusinessLogService businessLogService,
|
||||||
super(businessLogService);
|
BusinessProcessIdManager processIdManager) {
|
||||||
|
super(businessLogService, processIdManager);
|
||||||
this.dataService = dataService;
|
this.dataService = dataService;
|
||||||
this.dynamodbDataService = dynamodbDataService;
|
this.dynamodbDataService = dynamodbDataService;
|
||||||
this.landService = landService;
|
this.landService = landService;
|
||||||
this.dynamodbLandAuctionService = dynamodbLandAuctionService;
|
this.dynamodbLandAuctionService = dynamodbLandAuctionService;
|
||||||
}
|
}
|
||||||
|
|
||||||
@BusinessProcess(action = LogAction.SCHEDULE_DATA_INIT)
|
|
||||||
@Override
|
@Override
|
||||||
protected void executeInternal() {
|
protected void executeInternal() {
|
||||||
|
executeWithProcessId(LogAction.SCHEDULE_DATA_INIT, this::executeLogic);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void executeLogic() {
|
||||||
List<DataInit> scheduleList = dataService.getScheduleDataInitList();
|
List<DataInit> scheduleList = dataService.getScheduleDataInitList();
|
||||||
|
|
||||||
scheduleList.forEach(dataInit -> {
|
scheduleList.forEach(dataInit -> {
|
||||||
@@ -66,7 +71,6 @@ public class DataInitializeScheduler extends CommonScheduler {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@BusinessProcess(action = LogAction.DATA_INIT)
|
|
||||||
private void initLandAuction(LocalDateTime createDt){
|
private void initLandAuction(LocalDateTime createDt){
|
||||||
List<LandAuction> landAuctions = landService.getAllLandAuctionList();
|
List<LandAuction> landAuctions = landService.getAllLandAuctionList();
|
||||||
landAuctions.forEach(landAuction -> {
|
landAuctions.forEach(landAuction -> {
|
||||||
@@ -77,12 +81,10 @@ public class DataInitializeScheduler extends CommonScheduler {
|
|||||||
dynamodbDataService.InitDataLandAuction();
|
dynamodbDataService.InitDataLandAuction();
|
||||||
}
|
}
|
||||||
|
|
||||||
@BusinessProcess(action = LogAction.DATA_INIT)
|
|
||||||
private void initLandDesc(){
|
private void initLandDesc(){
|
||||||
dynamodbDataService.InitDataLandDesc();
|
dynamodbDataService.InitDataLandDesc();
|
||||||
}
|
}
|
||||||
|
|
||||||
@BusinessProcess(action = LogAction.DATA_INIT)
|
|
||||||
private void initLandOwner(LocalDateTime createDt){
|
private void initLandOwner(LocalDateTime createDt){
|
||||||
List<LandOwnerChange> landOwnerChanges = landService.getAllLandOwnerChangesList();
|
List<LandOwnerChange> landOwnerChanges = landService.getAllLandOwnerChangesList();
|
||||||
landOwnerChanges.forEach(dataService::initLandOwned);
|
landOwnerChanges.forEach(dataService::initLandOwned);
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import com.caliverse.admin.domain.entity.log.LogAction;
|
|||||||
import com.caliverse.admin.domain.entity.log.LogStatus;
|
import com.caliverse.admin.domain.entity.log.LogStatus;
|
||||||
import com.caliverse.admin.domain.service.EventService;
|
import com.caliverse.admin.domain.service.EventService;
|
||||||
import com.caliverse.admin.global.common.annotation.BusinessProcess;
|
import com.caliverse.admin.global.common.annotation.BusinessProcess;
|
||||||
|
import com.caliverse.admin.global.component.manager.BusinessProcessIdManager;
|
||||||
import com.caliverse.admin.mongodb.service.BusinessLogService;
|
import com.caliverse.admin.mongodb.service.BusinessLogService;
|
||||||
import com.caliverse.admin.scheduler.CommonScheduler;
|
import com.caliverse.admin.scheduler.CommonScheduler;
|
||||||
import com.caliverse.admin.scheduler.entity.SchedulerType;
|
import com.caliverse.admin.scheduler.entity.SchedulerType;
|
||||||
@@ -24,14 +25,18 @@ public class EventScheduler extends CommonScheduler {
|
|||||||
private final EventService eventService;
|
private final EventService eventService;
|
||||||
|
|
||||||
public EventScheduler(EventService eventService,
|
public EventScheduler(EventService eventService,
|
||||||
BusinessLogService businessLogService) {
|
BusinessLogService businessLogService,
|
||||||
super(businessLogService);
|
BusinessProcessIdManager processIdManager) {
|
||||||
|
super(businessLogService, processIdManager);
|
||||||
this.eventService = eventService;
|
this.eventService = eventService;
|
||||||
}
|
}
|
||||||
|
|
||||||
@BusinessProcess(action = LogAction.SCHEDULE_EVENT)
|
|
||||||
@Override
|
@Override
|
||||||
protected void executeInternal() {
|
protected void executeInternal() {
|
||||||
|
executeWithProcessId(LogAction.SCHEDULE_EVENT, this::executeLogic);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void executeLogic() {
|
||||||
List<Event> eventList = eventService.getScheduleMailList();
|
List<Event> eventList = eventService.getScheduleMailList();
|
||||||
|
|
||||||
LocalDateTime startTime = LocalDateTime.now();
|
LocalDateTime startTime = LocalDateTime.now();
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import com.caliverse.admin.dynamodb.entity.ELandAuctionResult;
|
|||||||
import com.caliverse.admin.dynamodb.entity.ELandAuctionState;
|
import com.caliverse.admin.dynamodb.entity.ELandAuctionState;
|
||||||
import com.caliverse.admin.global.common.annotation.BusinessProcess;
|
import com.caliverse.admin.global.common.annotation.BusinessProcess;
|
||||||
import com.caliverse.admin.global.common.utils.CommonUtils;
|
import com.caliverse.admin.global.common.utils.CommonUtils;
|
||||||
|
import com.caliverse.admin.global.component.manager.BusinessProcessIdManager;
|
||||||
import com.caliverse.admin.mongodb.service.BusinessLogService;
|
import com.caliverse.admin.mongodb.service.BusinessLogService;
|
||||||
import com.caliverse.admin.scheduler.CommonScheduler;
|
import com.caliverse.admin.scheduler.CommonScheduler;
|
||||||
import com.caliverse.admin.scheduler.entity.SchedulerType;
|
import com.caliverse.admin.scheduler.entity.SchedulerType;
|
||||||
@@ -29,14 +30,18 @@ public class LandAuctionScheduler extends CommonScheduler {
|
|||||||
private final LandService landService;
|
private final LandService landService;
|
||||||
|
|
||||||
public LandAuctionScheduler(LandService landService,
|
public LandAuctionScheduler(LandService landService,
|
||||||
BusinessLogService businessLogService) {
|
BusinessLogService businessLogService,
|
||||||
super(businessLogService);
|
BusinessProcessIdManager processIdManager) {
|
||||||
|
super(businessLogService, processIdManager);
|
||||||
this.landService = landService;
|
this.landService = landService;
|
||||||
}
|
}
|
||||||
|
|
||||||
@BusinessProcess(action = LogAction.SCHEDULE_LAND_AUCTION)
|
|
||||||
@Override
|
@Override
|
||||||
protected void executeInternal() {
|
protected void executeInternal() {
|
||||||
|
executeWithProcessId(LogAction.SCHEDULE_LAND_AUCTION, this::executeLogic);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void executeLogic() {
|
||||||
List<LandAuction> auctionList = landService.getScheduleLandAuctionList();
|
List<LandAuction> auctionList = landService.getScheduleLandAuctionList();
|
||||||
|
|
||||||
LocalDateTime startTime = LocalDateTime.now();
|
LocalDateTime startTime = LocalDateTime.now();
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.caliverse.admin.domain.service.UserGameSessionService;
|
|||||||
import com.caliverse.admin.dynamodb.service.DynamodbMailService;
|
import com.caliverse.admin.dynamodb.service.DynamodbMailService;
|
||||||
import com.caliverse.admin.dynamodb.service.DynamodbService;
|
import com.caliverse.admin.dynamodb.service.DynamodbService;
|
||||||
import com.caliverse.admin.global.common.annotation.BusinessProcess;
|
import com.caliverse.admin.global.common.annotation.BusinessProcess;
|
||||||
|
import com.caliverse.admin.global.component.manager.BusinessProcessIdManager;
|
||||||
import com.caliverse.admin.mongodb.service.BusinessLogService;
|
import com.caliverse.admin.mongodb.service.BusinessLogService;
|
||||||
import com.caliverse.admin.scheduler.CommonScheduler;
|
import com.caliverse.admin.scheduler.CommonScheduler;
|
||||||
import com.caliverse.admin.scheduler.entity.SchedulerType;
|
import com.caliverse.admin.scheduler.entity.SchedulerType;
|
||||||
@@ -35,17 +36,22 @@ public class LandOwnerChangesScheduler extends CommonScheduler {
|
|||||||
DynamodbLandService dynamodbLandService,
|
DynamodbLandService dynamodbLandService,
|
||||||
DynamodbMailService dynamodbMailService,
|
DynamodbMailService dynamodbMailService,
|
||||||
UserGameSessionService userGameSessionService,
|
UserGameSessionService userGameSessionService,
|
||||||
BusinessLogService businessLogService) {
|
BusinessLogService businessLogService,
|
||||||
super(businessLogService);
|
BusinessProcessIdManager processIdManager) {
|
||||||
|
super(businessLogService, processIdManager);
|
||||||
this.landService = landService;
|
this.landService = landService;
|
||||||
this.dynamodbLandService = dynamodbLandService;
|
this.dynamodbLandService = dynamodbLandService;
|
||||||
this.dynamodbMailService = dynamodbMailService;
|
this.dynamodbMailService = dynamodbMailService;
|
||||||
this.userGameSessionService = userGameSessionService;
|
this.userGameSessionService = userGameSessionService;
|
||||||
}
|
}
|
||||||
|
|
||||||
@BusinessProcess(action = LogAction.SCHEDULE_LAND_OWNER_CHANGE)
|
|
||||||
@Override
|
@Override
|
||||||
protected void executeInternal() {
|
protected void executeInternal() {
|
||||||
|
executeWithProcessId(LogAction.SCHEDULE_LAND_OWNER_CHANGE, this::executeLogic);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void executeLogic() {
|
||||||
List<LandOwnerChange> scheduleList = landService.getScheduleLandOwnerChangesList();
|
List<LandOwnerChange> scheduleList = landService.getScheduleLandOwnerChangesList();
|
||||||
|
|
||||||
LocalDateTime startTime = LocalDateTime.now();
|
LocalDateTime startTime = LocalDateTime.now();
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import com.caliverse.admin.domain.service.MailService;
|
|||||||
import com.caliverse.admin.global.common.annotation.BusinessProcess;
|
import com.caliverse.admin.global.common.annotation.BusinessProcess;
|
||||||
import com.caliverse.admin.global.common.utils.CommonUtils;
|
import com.caliverse.admin.global.common.utils.CommonUtils;
|
||||||
import com.caliverse.admin.global.common.utils.ExcelUtils;
|
import com.caliverse.admin.global.common.utils.ExcelUtils;
|
||||||
|
import com.caliverse.admin.global.component.manager.BusinessProcessIdManager;
|
||||||
import com.caliverse.admin.mongodb.service.BusinessLogService;
|
import com.caliverse.admin.mongodb.service.BusinessLogService;
|
||||||
import com.caliverse.admin.redis.service.RedisUserInfoService;
|
import com.caliverse.admin.redis.service.RedisUserInfoService;
|
||||||
import com.caliverse.admin.scheduler.CommonScheduler;
|
import com.caliverse.admin.scheduler.CommonScheduler;
|
||||||
@@ -48,8 +49,9 @@ public class MailScheduler extends CommonScheduler {
|
|||||||
MessageHandlerService messageHandlerService,
|
MessageHandlerService messageHandlerService,
|
||||||
ScheduleService schedulerService,
|
ScheduleService schedulerService,
|
||||||
ExcelUtils excelUtils,
|
ExcelUtils excelUtils,
|
||||||
BusinessLogService businessLogService) {
|
BusinessLogService businessLogService,
|
||||||
super(businessLogService);
|
BusinessProcessIdManager processIdManager) {
|
||||||
|
super(businessLogService, processIdManager);
|
||||||
this.mailService = mailService;
|
this.mailService = mailService;
|
||||||
this.redisUserInfoService = redisUserInfoService;
|
this.redisUserInfoService = redisUserInfoService;
|
||||||
this.messageHandlerService = messageHandlerService;
|
this.messageHandlerService = messageHandlerService;
|
||||||
@@ -57,9 +59,12 @@ public class MailScheduler extends CommonScheduler {
|
|||||||
this.excelUtils = excelUtils;
|
this.excelUtils = excelUtils;
|
||||||
}
|
}
|
||||||
|
|
||||||
@BusinessProcess(action = LogAction.SCHEDULE_MAIL)
|
|
||||||
@Override
|
@Override
|
||||||
protected void executeInternal() {
|
protected void executeInternal() {
|
||||||
|
executeWithProcessId(LogAction.SCHEDULE_MAIL, this::executeLogic);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void executeLogic(){
|
||||||
List<Mail> mailList = mailService.getScheduleMailList();
|
List<Mail> mailList = mailService.getScheduleMailList();
|
||||||
|
|
||||||
if (mailList.isEmpty()) {
|
if (mailList.isEmpty()) {
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import com.caliverse.admin.domain.entity.log.LogStatus;
|
|||||||
import com.caliverse.admin.domain.service.NoticeService;
|
import com.caliverse.admin.domain.service.NoticeService;
|
||||||
import com.caliverse.admin.global.common.annotation.BusinessProcess;
|
import com.caliverse.admin.global.common.annotation.BusinessProcess;
|
||||||
import com.caliverse.admin.global.common.utils.CommonUtils;
|
import com.caliverse.admin.global.common.utils.CommonUtils;
|
||||||
|
import com.caliverse.admin.global.component.manager.BusinessProcessIdManager;
|
||||||
import com.caliverse.admin.mongodb.service.BusinessLogService;
|
import com.caliverse.admin.mongodb.service.BusinessLogService;
|
||||||
import com.caliverse.admin.redis.service.RedisUserInfoService;
|
import com.caliverse.admin.redis.service.RedisUserInfoService;
|
||||||
import com.caliverse.admin.scheduler.CommonScheduler;
|
import com.caliverse.admin.scheduler.CommonScheduler;
|
||||||
@@ -40,17 +41,21 @@ public class NoticeScheduler extends CommonScheduler {
|
|||||||
RedisUserInfoService redisUserInfoService,
|
RedisUserInfoService redisUserInfoService,
|
||||||
ScheduleService schedulerService,
|
ScheduleService schedulerService,
|
||||||
MessageHandlerService messageHandlerService,
|
MessageHandlerService messageHandlerService,
|
||||||
BusinessLogService businessLogService) {
|
BusinessLogService businessLogService,
|
||||||
super(businessLogService);
|
BusinessProcessIdManager processIdManager) {
|
||||||
|
super(businessLogService, processIdManager);
|
||||||
this.noticeService = noticeService;
|
this.noticeService = noticeService;
|
||||||
this.redisUserInfoService = redisUserInfoService;
|
this.redisUserInfoService = redisUserInfoService;
|
||||||
this.schedulerService = schedulerService;
|
this.schedulerService = schedulerService;
|
||||||
this.messageHandlerService = messageHandlerService;
|
this.messageHandlerService = messageHandlerService;
|
||||||
}
|
}
|
||||||
|
|
||||||
@BusinessProcess(action = LogAction.SCHEDULE_NOTICE)
|
|
||||||
@Override
|
@Override
|
||||||
protected void executeInternal() {
|
protected void executeInternal() {
|
||||||
|
executeWithProcessId(LogAction.SCHEDULE_NOTICE, this::executeLogic);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void executeLogic(){
|
||||||
List<InGame> noticeList = noticeService.getScheduleNoticeList();
|
List<InGame> noticeList = noticeService.getScheduleNoticeList();
|
||||||
|
|
||||||
if(noticeList.isEmpty()) return;
|
if(noticeList.isEmpty()) return;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.caliverse.admin.scheduler.polling.service;
|
package com.caliverse.admin.scheduler.polling.service;
|
||||||
|
|
||||||
import com.caliverse.admin.domain.entity.log.LogAction;
|
import com.caliverse.admin.domain.entity.log.LogAction;
|
||||||
import com.caliverse.admin.global.common.annotation.BusinessProcess;
|
import com.caliverse.admin.global.component.manager.BusinessProcessIdManager;
|
||||||
import com.caliverse.admin.mongodb.service.BusinessLogService;
|
import com.caliverse.admin.mongodb.service.BusinessLogService;
|
||||||
import com.caliverse.admin.scheduler.CommonScheduler;
|
import com.caliverse.admin.scheduler.CommonScheduler;
|
||||||
import com.caliverse.admin.scheduler.ScheduleService;
|
import com.caliverse.admin.scheduler.ScheduleService;
|
||||||
@@ -16,14 +16,18 @@ public class cleanupScheduler extends CommonScheduler {
|
|||||||
private final ScheduleService scheduleService;
|
private final ScheduleService scheduleService;
|
||||||
|
|
||||||
public cleanupScheduler(ScheduleService scheduleService,
|
public cleanupScheduler(ScheduleService scheduleService,
|
||||||
BusinessLogService businessLogService) {
|
BusinessLogService businessLogService,
|
||||||
super(businessLogService);
|
BusinessProcessIdManager processIdManager) {
|
||||||
|
super(businessLogService, processIdManager);
|
||||||
this.scheduleService = scheduleService;
|
this.scheduleService = scheduleService;
|
||||||
}
|
}
|
||||||
|
|
||||||
@BusinessProcess(action = LogAction.SCHEDULE_CLEANUP)
|
|
||||||
@Override
|
@Override
|
||||||
protected void executeInternal() {
|
protected void executeInternal() {
|
||||||
|
executeWithProcessId(LogAction.SCHEDULE_CLEANUP, this::executeLogic);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void executeLogic() {
|
||||||
scheduleService.cleanupCompletedTasks();
|
scheduleService.cleanupCompletedTasks();
|
||||||
scheduleService.cleanupMailTasks();
|
scheduleService.cleanupMailTasks();
|
||||||
scheduleService.cleanupNoticeTasks();
|
scheduleService.cleanupNoticeTasks();
|
||||||
|
|||||||
@@ -211,37 +211,6 @@
|
|||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getCheckBattleEventList_bak" parameterType="com.caliverse.admin.domain.request.BattleEventRequest" resultMap="BattleEventResultMap">
|
|
||||||
SELECT id
|
|
||||||
, event_id
|
|
||||||
, repeat_type
|
|
||||||
, event_operation_time
|
|
||||||
, event_start_dt
|
|
||||||
, event_end_dt
|
|
||||||
FROM battle_event
|
|
||||||
WHERE status NOT IN ('END', 'FAIL', 'CANCEL', 'STOP')
|
|
||||||
<if test="id != null and id != ''">
|
|
||||||
AND id <> #{id}
|
|
||||||
</if>
|
|
||||||
AND (
|
|
||||||
/* NONE 타입인 경우 */
|
|
||||||
(repeat_type = 'NONE' AND DATE (event_start_dt) BETWEEN
|
|
||||||
DATE (#{eventStartDt})
|
|
||||||
AND DATE (#{eventEndDt}))
|
|
||||||
OR
|
|
||||||
/* DAY 타입인 경우 - 기간이 조금이라도 겹치면 가져옴 */
|
|
||||||
(repeat_type = 'DAY'
|
|
||||||
AND DATE (event_start_dt) <= DATE (#{eventEndDt})
|
|
||||||
AND DATE (event_end_dt) >= DATE (#{eventStartDt}))
|
|
||||||
OR
|
|
||||||
/* 요일 타입인 경우 - 기간이 겹치고 같은 요일이 있는 경우만 */
|
|
||||||
(repeat_type = #{repeatType}
|
|
||||||
AND DATE (event_start_dt) <= DATE (#{eventEndDt})
|
|
||||||
AND DATE (event_end_dt) >= DATE (#{eventStartDt})
|
|
||||||
)
|
|
||||||
)
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="chkTimeOver" parameterType="com.caliverse.admin.domain.request.BattleEventRequest" resultType="integer">
|
<select id="chkTimeOver" parameterType="com.caliverse.admin.domain.request.BattleEventRequest" resultType="integer">
|
||||||
SELECT COUNT(*)
|
SELECT COUNT(*)
|
||||||
FROM battle_event
|
FROM battle_event
|
||||||
|
|||||||
Reference in New Issue
Block a user