初次提交
This commit is contained in:
parent
8a67a6366e
commit
6a50a67bab
|
|
@ -78,6 +78,7 @@ public class ScenarioTaskServiceImpl extends
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
|
|
||||||
springGlobalTaskManager.startPerSecondTask(roomId + "_" + id + "_task", () -> {
|
springGlobalTaskManager.startPerSecondTask(roomId + "_" + id + "_task", () -> {
|
||||||
|
|
||||||
//时间累计
|
//时间累计
|
||||||
increaseTime(currentScenario, roomId);
|
increaseTime(currentScenario, roomId);
|
||||||
//天气触发
|
//天气触发
|
||||||
|
|
@ -105,6 +106,7 @@ public class ScenarioTaskServiceImpl extends
|
||||||
}
|
}
|
||||||
|
|
||||||
private void increaseTime(Scenario currentScenario, String roomId) {
|
private void increaseTime(Scenario currentScenario, String roomId) {
|
||||||
|
try{
|
||||||
int mag = Global.roomParamMap.get(currentScenario.getId() + "_" + roomId) == null ? 1
|
int mag = Global.roomParamMap.get(currentScenario.getId() + "_" + roomId) == null ? 1
|
||||||
: Global.roomParamMap.get(currentScenario.getId() + "_" + roomId).getMag();
|
: Global.roomParamMap.get(currentScenario.getId() + "_" + roomId).getMag();
|
||||||
//获取当前状态
|
//获取当前状态
|
||||||
|
|
@ -118,6 +120,10 @@ public class ScenarioTaskServiceImpl extends
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
log.error("error::",e);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -154,6 +160,7 @@ public class ScenarioTaskServiceImpl extends
|
||||||
}
|
}
|
||||||
|
|
||||||
private void taskTrigger(Scenario currentScenario, String roomId) {
|
private void taskTrigger(Scenario currentScenario, String roomId) {
|
||||||
|
try{
|
||||||
Object statusObj = redisUtil.hget(roomId + "_" + currentScenario.getId(), "status");
|
Object statusObj = redisUtil.hget(roomId + "_" + currentScenario.getId(), "status");
|
||||||
if (statusObj != null && statusObj.toString().equals("running")) {
|
if (statusObj != null && statusObj.toString().equals("running")) {
|
||||||
Object taskListObj = redisUtil.hget(roomId + "_" + currentScenario.getId(), "taskList");
|
Object taskListObj = redisUtil.hget(roomId + "_" + currentScenario.getId(), "taskList");
|
||||||
|
|
@ -183,6 +190,10 @@ public class ScenarioTaskServiceImpl extends
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
log.error("error::",e);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user