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