任务相关
This commit is contained in:
parent
e636f7d248
commit
ddf9e082f2
|
@ -18,6 +18,7 @@ import com.hivekion.scenario.entity.ScenarioResource;
|
|||
import com.hivekion.scenario.entity.ScenarioTask;
|
||||
import com.hivekion.scenario.service.impl.BattleSupplierServiceImpl;
|
||||
import com.hivekion.scenario.service.impl.ScenarioTaskServiceImpl;
|
||||
import com.hivekion.statistic.bean.EditScenarioInfo;
|
||||
import com.hivekion.statistic.bean.ScenarioInfo;
|
||||
import com.hivekion.statistic.bean.StatisticBean;
|
||||
import com.hivekion.statistic.service.impl.StatisticServiceImpl;
|
||||
|
@ -32,10 +33,8 @@ import java.util.Map.Entry;
|
|||
import java.util.NavigableMap;
|
||||
import java.util.TreeMap;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
@ -259,11 +258,12 @@ public abstract class AbtParentTask implements TaskAction {
|
|||
if (this.getRoomStatus()) {
|
||||
|
||||
double currentFuel = getCurrentFuel();
|
||||
if (currentFuel < 0) {
|
||||
double totalFuel = statisticBean.getFuel().getTotal();
|
||||
if (currentFuel <= 0 || totalFuel <= 0) {
|
||||
log.error("{}:油量为零停止移动", this.scenarioTask.getResourceId());
|
||||
return;
|
||||
}
|
||||
double totalFuel = statisticBean.getFuel().getTotal();
|
||||
|
||||
log.info("{}-当前比值{},阈值{}", scenarioTask.getResourceId(),
|
||||
currentFuel * 100 / totalFuel,
|
||||
fuelThreshold);
|
||||
|
@ -340,6 +340,15 @@ public abstract class AbtParentTask implements TaskAction {
|
|||
ResponseCmdInfo.create(WsCmdTypeEnum.PATH_UPDATE.getCode(), roomId,
|
||||
scenarioTask.getScenarioId(), dataMap));
|
||||
|
||||
//修改位置信息
|
||||
|
||||
EditScenarioInfo editScenarioInfo = getEditScenarioInfo(
|
||||
this.scenarioTask.getResourceId());
|
||||
editScenarioInfo.getJbxx().getTeam().setLat(coordinate.getLat() + "");
|
||||
editScenarioInfo.getJbxx().getTeam().setLng(coordinate.getLng() + "");
|
||||
setEditScenarioInfo(editScenarioInfo);
|
||||
pushStatus(scenarioTask.getResourceId());
|
||||
|
||||
} else if (Double.compare(distance, endPoint.getKey()) == 0) {
|
||||
NavigableMap<Double, Coordinate> subPathMap = distanceInfoMap.subMap(startPoint.get(),
|
||||
true, endPoint.getKey(), true);
|
||||
|
@ -381,6 +390,19 @@ public abstract class AbtParentTask implements TaskAction {
|
|||
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
protected EditScenarioInfo getEditScenarioInfo(String resourceId) {
|
||||
String updJsonStr = (String) redisUtil.hget(
|
||||
this.scenarioTask.getScenarioId() + "-" + roomId + "-" + scenarioTask.getResourceId(),
|
||||
"updScenarioInfo");
|
||||
return JSON.parseObject(updJsonStr, EditScenarioInfo.class);
|
||||
}
|
||||
|
||||
protected void setEditScenarioInfo(EditScenarioInfo editScenarioInfo) {
|
||||
redisUtil.hset(
|
||||
this.scenarioTask.getScenarioId() + "-" + roomId + "-" + scenarioTask.getResourceId(),
|
||||
"updScenarioInfo", JSON.toJSONString(editScenarioInfo));
|
||||
}
|
||||
|
||||
//统一推送方法
|
||||
protected void pushStatus(String resourceId) {
|
||||
if (StringUtils.isBlank(resourceId)) {
|
||||
|
@ -410,7 +432,7 @@ public abstract class AbtParentTask implements TaskAction {
|
|||
}
|
||||
|
||||
protected double getCurrentFuel() {
|
||||
Object statisticObj = redisUtil.hget(
|
||||
Object statisticObj = SpringUtil.getBean(RedisUtil.class).hget(
|
||||
scenarioTask.getScenarioId() + "-" + roomId + "-" + scenarioTask.getResourceId(),
|
||||
"scenarioInfo");
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ death.warn = 56
|
|||
ammunition.warn = 3
|
||||
food.warn = 3
|
||||
water.warn = 3
|
||||
fuel.warn = 99.6
|
||||
fuel.warn = 80.6
|
||||
medical.warn = 1
|
||||
death.spreed = 3
|
||||
injured.spreed = 3
|
||||
|
|
Loading…
Reference in New Issue
Block a user