任务相关
This commit is contained in:
parent
b1d913698d
commit
b83d98c178
|
|
@ -265,6 +265,7 @@ public abstract class AbtParentTask implements TaskAction {
|
||||||
coordinate.setLng(insertPoints[1]);
|
coordinate.setLng(insertPoints[1]);
|
||||||
distanceInfoMap.put(distance, coordinate);
|
distanceInfoMap.put(distance, coordinate);
|
||||||
startPoint.set(distance);
|
startPoint.set(distance);
|
||||||
|
coordinateReference.set(coordinate);
|
||||||
SpringUtil.getBean(RedisUtil.class).hset(
|
SpringUtil.getBean(RedisUtil.class).hset(
|
||||||
scenarioTask.getScenarioId() + "-" + roomId + "-" + scenarioTask.getResourceId(),
|
scenarioTask.getScenarioId() + "-" + roomId + "-" + scenarioTask.getResourceId(),
|
||||||
"position", JSON.toJSONString(coordinate));
|
"position", JSON.toJSONString(coordinate));
|
||||||
|
|
@ -280,7 +281,7 @@ public abstract class AbtParentTask implements TaskAction {
|
||||||
Coordinate coordinate = subPathMap.get(key);
|
Coordinate coordinate = subPathMap.get(key);
|
||||||
dataList.add(new double[]{coordinate.getLng(), coordinate.getLat()});
|
dataList.add(new double[]{coordinate.getLng(), coordinate.getLat()});
|
||||||
}
|
}
|
||||||
|
coordinateReference.set(endPoint.getValue());
|
||||||
startPoint.set(endPoint.getKey());
|
startPoint.set(endPoint.getKey());
|
||||||
Global.sendCmdInfoQueue.add(
|
Global.sendCmdInfoQueue.add(
|
||||||
ResponseCmdInfo.create(WsCmdTypeEnum.PATH_UPDATE.getCode(), roomId,
|
ResponseCmdInfo.create(WsCmdTypeEnum.PATH_UPDATE.getCode(), roomId,
|
||||||
|
|
|
||||||
|
|
@ -119,8 +119,8 @@ public class MoveTask extends AbtParentTask implements TaskAction {
|
||||||
fuelThreshold = Double.parseDouble(SpringUtil.getBean(Environment.class)
|
fuelThreshold = Double.parseDouble(SpringUtil.getBean(Environment.class)
|
||||||
.getProperty("fuel.warn", "0"));
|
.getProperty("fuel.warn", "0"));
|
||||||
|
|
||||||
log.info("初始化::{}-油料消耗速度::{},油料最低阈值::{}", this.scenarioTask.getResourceId(),
|
log.info("初始化::{}-油料消耗速度::{},油料最低阈值::{},当前油料::{}", this.scenarioTask.getResourceId(),
|
||||||
fuelConsumptionStr, fuelThreshold);
|
fuelConsumptionStr, fuelThreshold,getCurrentFuel());
|
||||||
statisticBean = SpringUtil.getBean(StatisticServiceImpl.class)
|
statisticBean = SpringUtil.getBean(StatisticServiceImpl.class)
|
||||||
.statistic(scenarioTask.getResourceId());
|
.statistic(scenarioTask.getResourceId());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
@ -136,7 +136,7 @@ public class MoveTask extends AbtParentTask implements TaskAction {
|
||||||
1);
|
1);
|
||||||
schedule.scheduleWithFixedDelay(() -> {
|
schedule.scheduleWithFixedDelay(() -> {
|
||||||
if (getRoomStatus() && this.canMoved.get()) {
|
if (getRoomStatus() && this.canMoved.get()) {
|
||||||
double currentUseUp = consumptionTaskInterval * SPEED / 1000 * fuelConsumption;
|
double currentUseUp = consumptionTaskInterval*RoomManager.getMag(roomId) * SPEED / 1000 * fuelConsumption;
|
||||||
|
|
||||||
double fuel = getCurrentFuel();
|
double fuel = getCurrentFuel();
|
||||||
log.info("{}-当前消耗油料::{},当前剩余油料::{}", scenarioTask.getResourceId(),
|
log.info("{}-当前消耗油料::{},当前剩余油料::{}", scenarioTask.getResourceId(),
|
||||||
|
|
@ -211,8 +211,9 @@ public class MoveTask extends AbtParentTask implements TaskAction {
|
||||||
ScenarioTask task = new ScenarioTask();
|
ScenarioTask task = new ScenarioTask();
|
||||||
task.setId(IdUtils.simpleUUID());
|
task.setId(IdUtils.simpleUUID());
|
||||||
task.setScenarioId(scenarioTask.getScenarioId());
|
task.setScenarioId(scenarioTask.getScenarioId());
|
||||||
task.setResourceId(scenarioTask.getResourceId());
|
task.setResourceId(resourceList.get(0).getId());
|
||||||
task.setTaskType("6");
|
task.setTaskType("6");
|
||||||
|
task.setInsureResourceId(scenarioTask.getResourceId());
|
||||||
task.setSupplierNum(statisticBean.getFuel().getTotal());
|
task.setSupplierNum(statisticBean.getFuel().getTotal());
|
||||||
task.setToLat(this.coordinateReference.get().getLat() + "");
|
task.setToLat(this.coordinateReference.get().getLat() + "");
|
||||||
task.setToLng(this.coordinateReference.get().getLng() + "");
|
task.setToLng(this.coordinateReference.get().getLng() + "");
|
||||||
|
|
@ -221,8 +222,8 @@ public class MoveTask extends AbtParentTask implements TaskAction {
|
||||||
task.setFromLng(resourceList.get(0).getLng());
|
task.setFromLng(resourceList.get(0).getLng());
|
||||||
task.setFromSource("general");
|
task.setFromSource("general");
|
||||||
|
|
||||||
log.info("{}-保障分队id::{},from::{},to::{}", this.scenarioTask.getResourceId(),
|
log.info("{}-保障分队id::{},from::{},to::{}", this.scenarioTask.getInsureResourceId(),
|
||||||
task.getSupplierResourceId(), task.getFromLat() + "," + task.getFromLng(),
|
task.getResourceId(), task.getFromLat() + "," + task.getFromLng(),
|
||||||
task.getToLat() + "," + task.getToLng());
|
task.getToLat() + "," + task.getToLng());
|
||||||
|
|
||||||
SpringUtil.getBean(ScenarioTaskServiceImpl.class).save(task);
|
SpringUtil.getBean(ScenarioTaskServiceImpl.class).save(task);
|
||||||
|
|
@ -258,6 +259,7 @@ public class MoveTask extends AbtParentTask implements TaskAction {
|
||||||
Object statisticObj = redis.hget(
|
Object statisticObj = redis.hget(
|
||||||
scenarioTask.getScenarioId() + "-" + roomId + "-" + scenarioTask.getResourceId(),
|
scenarioTask.getScenarioId() + "-" + roomId + "-" + scenarioTask.getResourceId(),
|
||||||
"scenarioInfo");
|
"scenarioInfo");
|
||||||
|
|
||||||
if (statisticObj != null) {
|
if (statisticObj != null) {
|
||||||
ScenarioInfo scenarioInfo = JSON.parseObject(statisticObj.toString(), ScenarioInfo.class);
|
ScenarioInfo scenarioInfo = JSON.parseObject(statisticObj.toString(), ScenarioInfo.class);
|
||||||
return scenarioInfo.getFuel().getCurrent();
|
return scenarioInfo.getFuel().getCurrent();
|
||||||
|
|
|
||||||
|
|
@ -77,13 +77,13 @@ public class SupplierTask extends AbtParentTask implements TaskAction {
|
||||||
|
|
||||||
//增加被保障分队的量
|
//增加被保障分队的量
|
||||||
SpringUtil.getBean(RedisUtil.class)
|
SpringUtil.getBean(RedisUtil.class)
|
||||||
.hset(scenarioTask.getScenarioId() + "-" + roomId + "-" + scenarioTask.getResourceId(),
|
.hset(scenarioTask.getScenarioId() + "-" + roomId + "-" + scenarioTask.getInsureResourceId(),
|
||||||
"medical", statistic.getMedical().getTotal() + "");
|
"medical", statistic.getMedical().getTotal() + "");
|
||||||
|
|
||||||
//获取保障任务的药品信息
|
//获取保障任务的药品信息
|
||||||
Object supplierObj = SpringUtil.getBean(RedisUtil.class)
|
Object supplierObj = SpringUtil.getBean(RedisUtil.class)
|
||||||
.hget(scenarioTask.getScenarioId() + "-" + roomId + "-"
|
.hget(scenarioTask.getScenarioId() + "-" + roomId + "-"
|
||||||
+ scenarioTask.getSupplierResourceId(),
|
+ scenarioTask.getResourceId(),
|
||||||
"medical");
|
"medical");
|
||||||
//减少保障分队的量
|
//减少保障分队的量
|
||||||
if (supplierObj != null) {
|
if (supplierObj != null) {
|
||||||
|
|
@ -92,7 +92,7 @@ public class SupplierTask extends AbtParentTask implements TaskAction {
|
||||||
double remain = supplierMedical - statistic.getMedical().getTotal();
|
double remain = supplierMedical - statistic.getMedical().getTotal();
|
||||||
SpringUtil.getBean(RedisUtil.class)
|
SpringUtil.getBean(RedisUtil.class)
|
||||||
.hset(scenarioTask.getScenarioId() + "-" + roomId + "-"
|
.hset(scenarioTask.getScenarioId() + "-" + roomId + "-"
|
||||||
+ scenarioTask.getSupplierResourceId(),
|
+ scenarioTask.getResourceId(),
|
||||||
"medical", remain + "");
|
"medical", remain + "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -100,12 +100,12 @@ public class SupplierTask extends AbtParentTask implements TaskAction {
|
||||||
private void supplierFuel(StatisticBean statistic) {
|
private void supplierFuel(StatisticBean statistic) {
|
||||||
|
|
||||||
SpringUtil.getBean(RedisUtil.class)
|
SpringUtil.getBean(RedisUtil.class)
|
||||||
.hset(scenarioTask.getScenarioId() + "-" + roomId + "-" + scenarioTask.getResourceId(),
|
.hset(scenarioTask.getScenarioId() + "-" + roomId + "-" + scenarioTask.getInsureResourceId(),
|
||||||
"fuel", statistic.getFuel().getTotal() + "");
|
"fuel", statistic.getFuel().getTotal() + "");
|
||||||
|
|
||||||
Object supplierObj = SpringUtil.getBean(RedisUtil.class)
|
Object supplierObj = SpringUtil.getBean(RedisUtil.class)
|
||||||
.hget(scenarioTask.getScenarioId() + "-" + roomId + "-"
|
.hget(scenarioTask.getScenarioId() + "-" + roomId + "-"
|
||||||
+ scenarioTask.getSupplierResourceId(),
|
+ scenarioTask.getResourceId(),
|
||||||
"fuel");
|
"fuel");
|
||||||
//减少保障分队的量
|
//减少保障分队的量
|
||||||
if (supplierObj != null) {
|
if (supplierObj != null) {
|
||||||
|
|
@ -114,7 +114,7 @@ public class SupplierTask extends AbtParentTask implements TaskAction {
|
||||||
double remain = supplierMedical - statistic.getFuel().getTotal();
|
double remain = supplierMedical - statistic.getFuel().getTotal();
|
||||||
SpringUtil.getBean(RedisUtil.class)
|
SpringUtil.getBean(RedisUtil.class)
|
||||||
.hset(scenarioTask.getScenarioId() + "-" + roomId + "-"
|
.hset(scenarioTask.getScenarioId() + "-" + roomId + "-"
|
||||||
+ scenarioTask.getSupplierResourceId(),
|
+ scenarioTask.getResourceId(),
|
||||||
"fuel", remain + "");
|
"fuel", remain + "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -122,11 +122,11 @@ public class SupplierTask extends AbtParentTask implements TaskAction {
|
||||||
private void supplierAmmunition(StatisticBean statistic) {
|
private void supplierAmmunition(StatisticBean statistic) {
|
||||||
|
|
||||||
SpringUtil.getBean(RedisUtil.class)
|
SpringUtil.getBean(RedisUtil.class)
|
||||||
.hset(scenarioTask.getScenarioId() + "-" + roomId + "-" + scenarioTask.getResourceId(),
|
.hset(scenarioTask.getScenarioId() + "-" + roomId + "-" + scenarioTask.getInsureResourceId(),
|
||||||
"ammunition", statistic.getAmmunition().getTotal() + "");
|
"ammunition", statistic.getAmmunition().getTotal() + "");
|
||||||
Object supplierObj = SpringUtil.getBean(RedisUtil.class)
|
Object supplierObj = SpringUtil.getBean(RedisUtil.class)
|
||||||
.hget(scenarioTask.getScenarioId() + "-" + roomId + "-"
|
.hget(scenarioTask.getScenarioId() + "-" + roomId + "-"
|
||||||
+ scenarioTask.getSupplierResourceId(),
|
+ scenarioTask.getResourceId(),
|
||||||
"ammunition");
|
"ammunition");
|
||||||
//减少保障分队的量
|
//减少保障分队的量
|
||||||
if (supplierObj != null) {
|
if (supplierObj != null) {
|
||||||
|
|
@ -135,7 +135,7 @@ public class SupplierTask extends AbtParentTask implements TaskAction {
|
||||||
double remain = supplierMedical - statistic.getAmmunition().getTotal();
|
double remain = supplierMedical - statistic.getAmmunition().getTotal();
|
||||||
SpringUtil.getBean(RedisUtil.class)
|
SpringUtil.getBean(RedisUtil.class)
|
||||||
.hset(scenarioTask.getScenarioId() + "-" + roomId + "-"
|
.hset(scenarioTask.getScenarioId() + "-" + roomId + "-"
|
||||||
+ scenarioTask.getSupplierResourceId(),
|
+ scenarioTask.getResourceId(),
|
||||||
"ammunition", remain + "");
|
"ammunition", remain + "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -143,11 +143,11 @@ public class SupplierTask extends AbtParentTask implements TaskAction {
|
||||||
private void supplierWater(StatisticBean statistic) {
|
private void supplierWater(StatisticBean statistic) {
|
||||||
|
|
||||||
SpringUtil.getBean(RedisUtil.class)
|
SpringUtil.getBean(RedisUtil.class)
|
||||||
.hset(scenarioTask.getScenarioId() + "-" + roomId + "-" + scenarioTask.getResourceId(),
|
.hset(scenarioTask.getScenarioId() + "-" + roomId + "-" + scenarioTask.getInsureResourceId(),
|
||||||
"water", statistic.getWater().getTotal() + "");
|
"water", statistic.getWater().getTotal() + "");
|
||||||
Object supplierObj = SpringUtil.getBean(RedisUtil.class)
|
Object supplierObj = SpringUtil.getBean(RedisUtil.class)
|
||||||
.hget(scenarioTask.getScenarioId() + "-" + roomId + "-"
|
.hget(scenarioTask.getScenarioId() + "-" + roomId + "-"
|
||||||
+ scenarioTask.getSupplierResourceId(),
|
+ scenarioTask.getResourceId(),
|
||||||
"water");
|
"water");
|
||||||
//减少保障分队的量
|
//减少保障分队的量
|
||||||
if (supplierObj != null) {
|
if (supplierObj != null) {
|
||||||
|
|
@ -156,7 +156,7 @@ public class SupplierTask extends AbtParentTask implements TaskAction {
|
||||||
double remain = supplierMedical - statistic.getWater().getTotal();
|
double remain = supplierMedical - statistic.getWater().getTotal();
|
||||||
SpringUtil.getBean(RedisUtil.class)
|
SpringUtil.getBean(RedisUtil.class)
|
||||||
.hset(scenarioTask.getScenarioId() + "-" + roomId + "-"
|
.hset(scenarioTask.getScenarioId() + "-" + roomId + "-"
|
||||||
+ scenarioTask.getSupplierResourceId(),
|
+ scenarioTask.getResourceId(),
|
||||||
"water", remain + "");
|
"water", remain + "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -164,11 +164,11 @@ public class SupplierTask extends AbtParentTask implements TaskAction {
|
||||||
private void supplierFood(StatisticBean statistic) {
|
private void supplierFood(StatisticBean statistic) {
|
||||||
|
|
||||||
SpringUtil.getBean(RedisUtil.class)
|
SpringUtil.getBean(RedisUtil.class)
|
||||||
.hset(scenarioTask.getScenarioId() + "-" + roomId + "-" + scenarioTask.getResourceId(),
|
.hset(scenarioTask.getScenarioId() + "-" + roomId + "-" + scenarioTask.getInsureResourceId(),
|
||||||
"food", statistic.getFood().getTotal() + "");
|
"food", statistic.getFood().getTotal() + "");
|
||||||
Object supplierObj = SpringUtil.getBean(RedisUtil.class)
|
Object supplierObj = SpringUtil.getBean(RedisUtil.class)
|
||||||
.hget(scenarioTask.getScenarioId() + "-" + roomId + "-"
|
.hget(scenarioTask.getScenarioId() + "-" + roomId + "-"
|
||||||
+ scenarioTask.getSupplierResourceId(),
|
+ scenarioTask.getResourceId(),
|
||||||
"food");
|
"food");
|
||||||
//减少保障分队的量
|
//减少保障分队的量
|
||||||
if (supplierObj != null) {
|
if (supplierObj != null) {
|
||||||
|
|
@ -177,7 +177,7 @@ public class SupplierTask extends AbtParentTask implements TaskAction {
|
||||||
double remain = supplierMedical - statistic.getFood().getTotal();
|
double remain = supplierMedical - statistic.getFood().getTotal();
|
||||||
SpringUtil.getBean(RedisUtil.class)
|
SpringUtil.getBean(RedisUtil.class)
|
||||||
.hset(scenarioTask.getScenarioId() + "-" + roomId + "-"
|
.hset(scenarioTask.getScenarioId() + "-" + roomId + "-"
|
||||||
+ scenarioTask.getSupplierResourceId(),
|
+ scenarioTask.getResourceId(),
|
||||||
"food", remain + "");
|
"food", remain + "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -60,8 +60,8 @@ public class ScenarioTask implements Serializable {
|
||||||
private String status = "init";
|
private String status = "init";
|
||||||
@TableField(value = "during_time")
|
@TableField(value = "during_time")
|
||||||
private Integer duringTime;
|
private Integer duringTime;
|
||||||
@TableField(value = "supplier_resource_id")
|
@TableField(value = "INSURE_RESOURCE_ID")
|
||||||
private String supplierResourceId;
|
private String insureResourceId;
|
||||||
@TableField(value = "supplier_num")
|
@TableField(value = "supplier_num")
|
||||||
private double supplierNum;
|
private double supplierNum;
|
||||||
@TableField(value="from_source")
|
@TableField(value="from_source")
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,7 @@ public class BattleSupplierServiceImpl extends
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ScenarioResource> selectSupplierResource(String battleResourceId) {
|
public List<ScenarioResource> selectSupplierResource(String battleResourceId) {
|
||||||
|
|
||||||
return this.baseMapper.selectSupplierResource(battleResourceId);
|
return this.baseMapper.selectSupplierResource(battleResourceId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ death.warn = 56
|
||||||
ammunition.warn = 3
|
ammunition.warn = 3
|
||||||
food.warn = 3
|
food.warn = 3
|
||||||
water.warn = 3
|
water.warn = 3
|
||||||
fuel.warn = 93
|
fuel.warn = 99.6
|
||||||
medical.warn = 1
|
medical.warn = 1
|
||||||
death.spreed = 3
|
death.spreed = 3
|
||||||
injured.spreed = 3
|
injured.spreed = 3
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
<select id="selectSupplierResource" resultType="com.hivekion.scenario.entity.ScenarioResource">
|
<select id="selectSupplierResource" resultType="com.hivekion.scenario.entity.ScenarioResource">
|
||||||
select id ,lng,lat,scenario_Id as scenarioId, resource_name as resourceName
|
select id ,lng,lat,scenario_Id as scenarioId, resource_name as resourceName
|
||||||
from tbl_scenario_resource
|
from tbl_scenario_resource
|
||||||
where resource_id in
|
where id in
|
||||||
(select supplier_resource_id from tbl_battle_supplier where battle_resource_id = #{battleResourceId})
|
(select supplier_resource_id from tbl_battle_supplier where battle_resource_id = #{battleResourceId})
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user