任务相关
This commit is contained in:
parent
f59eabb06f
commit
e0dc6d32f8
|
|
@ -206,12 +206,16 @@ public abstract class AbtParentTask implements TaskAction {
|
|||
ScheduledExecutorService schedule = Executors.newScheduledThreadPool(
|
||||
1);
|
||||
schedule.scheduleWithFixedDelay(() -> {
|
||||
log.info("task is running....");
|
||||
|
||||
try {
|
||||
if (this.getRoomStatus()) {
|
||||
if (distanceInfoMap.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
if(!this.canMoved.get()){
|
||||
return;
|
||||
}
|
||||
log.info("{}-移动中",this.scenarioTask.getResourceId());
|
||||
long duringTime = getDuringTime() - taskRelativeTime;
|
||||
if (duringTime <= 0) {
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -113,10 +113,12 @@ public class MoveTask extends AbtParentTask implements TaskAction {
|
|||
try {
|
||||
//获取油品消耗规则
|
||||
String fuelConsumptionStr = SpringUtil.getBean(Environment.class)
|
||||
.getProperty("fuel_spreed");
|
||||
.getProperty("fuel.spreed");
|
||||
log.info("油料消耗速度::{}",fuelConsumptionStr);
|
||||
fuelConsumption = Double.parseDouble(fuelConsumptionStr == null ? "0" : fuelConsumptionStr);
|
||||
fuelThreshold = Double.parseDouble(SpringUtil.getBean(Environment.class)
|
||||
.getProperty("fuel.warn ", "0"));
|
||||
log.info("油料最低阈值::{}",fuelThreshold);
|
||||
statisticBean = SpringUtil.getBean(StatisticServiceImpl.class)
|
||||
.statistic(scenarioTask.getResourceId());
|
||||
} catch (Exception e) {
|
||||
|
|
@ -136,10 +138,12 @@ public class MoveTask extends AbtParentTask implements TaskAction {
|
|||
|
||||
double fuel = getCurrentFuel();
|
||||
if (fuel == 0) {
|
||||
log.error("fuel is empty");
|
||||
log.error("{}-油料为空",scenarioTask.getResourceId());
|
||||
this.canMoved.set(false);
|
||||
return;
|
||||
}
|
||||
fuel = fuel - currentUseUp;
|
||||
log.info("{}-当前油料{}",scenarioTask.getResourceId(),fuel);
|
||||
Object statisticObj = redis.hget(
|
||||
scenarioTask.getScenarioId() + "-" + roomId + "-" + scenarioTask.getResourceId(),
|
||||
"scenarioInfo");
|
||||
|
|
@ -153,7 +157,7 @@ public class MoveTask extends AbtParentTask implements TaskAction {
|
|||
|
||||
double totalFuel = statisticBean.getFuel().getTotal();
|
||||
if (fuel * 100 / totalFuel < fuelThreshold && !requestFlag.get()) {
|
||||
log.info("fuel is not enough,stop moving");
|
||||
log.info("{}-油料不足",scenarioTask.getResourceId());
|
||||
this.canMoved.set(false);
|
||||
requestFlag.set(true);
|
||||
//需要产生需求
|
||||
|
|
|
|||
|
|
@ -5,10 +5,10 @@ food.warn = 3
|
|||
water.warn = 3
|
||||
fuel.warn = 2
|
||||
medical.warn = 1
|
||||
death.spreed = 3;
|
||||
injured.spreed = 3;
|
||||
ammunition.spreed = 2.6;
|
||||
food.spreed = 2.3;
|
||||
water.spreed = 3.6;
|
||||
fuel.spreed = 3.6;
|
||||
medical.spreed = 1.6;
|
||||
death.spreed = 3
|
||||
injured.spreed = 3
|
||||
ammunition.spreed = 2.6
|
||||
food.spreed = 2.3
|
||||
water.spreed = 3.6
|
||||
fuel.spreed = 3.6
|
||||
medical.spreed = 1.6
|
||||
Loading…
Reference in New Issue
Block a user