2025-09-18 10:47:37 +08:00
|
|
|
|
package com.hivekion.room.bean;
|
|
|
|
|
|
|
2025-09-18 16:19:42 +08:00
|
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
2025-09-18 15:23:09 +08:00
|
|
|
|
import cn.hutool.extra.spring.SpringUtil;
|
2025-09-19 11:18:01 +08:00
|
|
|
|
import com.alibaba.fastjson2.JSON;
|
2025-09-18 15:23:09 +08:00
|
|
|
|
import com.alibaba.fastjson2.JSONObject;
|
2025-09-18 11:20:55 +08:00
|
|
|
|
import com.hivekion.Global;
|
2025-09-18 15:23:09 +08:00
|
|
|
|
import com.hivekion.common.entity.ResponseCmdInfo;
|
|
|
|
|
|
import com.hivekion.common.redis.RedisUtil;
|
2025-09-18 21:03:36 +08:00
|
|
|
|
import com.hivekion.common.uuid.IdUtils;
|
2025-09-19 15:05:41 +08:00
|
|
|
|
import com.hivekion.scenario.entity.BattleConsume;
|
2025-09-18 10:47:37 +08:00
|
|
|
|
import com.hivekion.scenario.entity.ScenarioTask;
|
2025-09-19 15:05:41 +08:00
|
|
|
|
import com.hivekion.scenario.service.IBattleConsumeService;
|
2025-09-18 15:23:09 +08:00
|
|
|
|
import com.hivekion.statistic.bean.*;
|
|
|
|
|
|
import com.hivekion.statistic.service.StatisticService;
|
|
|
|
|
|
import com.hivekion.statistic.service.impl.StatisticServiceImpl;
|
2025-09-18 16:19:42 +08:00
|
|
|
|
import com.hivekion.supplier.entity.SupplierRequest;
|
|
|
|
|
|
import com.hivekion.supplier.service.ISupplierRequestService;
|
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
2025-09-18 22:51:44 +08:00
|
|
|
|
import org.springframework.core.env.Environment;
|
2025-09-18 16:19:42 +08:00
|
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
|
2025-09-19 15:05:41 +08:00
|
|
|
|
import javax.swing.*;
|
2025-09-18 16:19:42 +08:00
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
|
|
import java.time.ZoneId;
|
|
|
|
|
|
import java.util.*;
|
2025-09-18 15:23:09 +08:00
|
|
|
|
import java.util.concurrent.Executors;
|
|
|
|
|
|
import java.util.concurrent.ScheduledExecutorService;
|
|
|
|
|
|
import java.util.concurrent.TimeUnit;
|
2025-09-18 10:47:37 +08:00
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* [类的简要说明]
|
|
|
|
|
|
* <p>
|
|
|
|
|
|
* [详细描述,可选]
|
|
|
|
|
|
* <p>
|
|
|
|
|
|
*
|
|
|
|
|
|
* @author LiDongYU
|
|
|
|
|
|
* @since 2025/7/22
|
|
|
|
|
|
*/
|
2025-09-18 16:19:42 +08:00
|
|
|
|
@Slf4j
|
2025-09-18 10:47:37 +08:00
|
|
|
|
public class BattleRootTask extends AbtParentTask {
|
|
|
|
|
|
|
2025-09-18 15:23:09 +08:00
|
|
|
|
private StatisticService statisticService = null;
|
|
|
|
|
|
private RedisUtil redisUtil = null;
|
|
|
|
|
|
|
2025-09-18 16:19:42 +08:00
|
|
|
|
private ISupplierRequestService supplierRequestService;
|
|
|
|
|
|
|
2025-09-19 15:05:41 +08:00
|
|
|
|
private IBattleConsumeService battleConsumeService;
|
|
|
|
|
|
|
2025-09-19 11:18:01 +08:00
|
|
|
|
private static final Integer DEATH_SPREED = 3;
|
|
|
|
|
|
private static final Integer INJURED_SPREED = 3;
|
2025-09-18 15:23:09 +08:00
|
|
|
|
private static final Double AMMUNITION_SPREED = 2.6D;
|
|
|
|
|
|
private static final Double FOOD_SPREED = 2.3D;
|
|
|
|
|
|
private static final Double WATER_SPREED = 3.6D;
|
|
|
|
|
|
private static final Double FUEL_SPREED = 3.6D;
|
|
|
|
|
|
private static final Double MEDICAL_SPREED = 1.6D;
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-09-18 10:47:37 +08:00
|
|
|
|
|
|
|
|
|
|
public BattleRootTask(ScenarioTask scenarioTask,String roomId) {
|
|
|
|
|
|
super(scenarioTask,roomId);
|
|
|
|
|
|
}
|
2025-09-18 15:23:09 +08:00
|
|
|
|
|
|
|
|
|
|
private void initBean(){
|
|
|
|
|
|
if(statisticService == null) {
|
2025-09-18 21:03:36 +08:00
|
|
|
|
statisticService = SpringUtil.getBean(StatisticService.class);
|
2025-09-18 15:23:09 +08:00
|
|
|
|
}
|
|
|
|
|
|
if(redisUtil == null) {
|
2025-09-18 21:03:36 +08:00
|
|
|
|
redisUtil = SpringUtil.getBean(RedisUtil.class);
|
2025-09-18 15:23:09 +08:00
|
|
|
|
}
|
2025-09-18 16:19:42 +08:00
|
|
|
|
if(supplierRequestService == null){
|
2025-09-18 21:03:36 +08:00
|
|
|
|
supplierRequestService = SpringUtil.getBean(ISupplierRequestService.class);
|
2025-09-18 16:19:42 +08:00
|
|
|
|
}
|
2025-09-19 15:05:41 +08:00
|
|
|
|
if(battleConsumeService == null){
|
|
|
|
|
|
battleConsumeService = SpringUtil.getBean(IBattleConsumeService.class);
|
|
|
|
|
|
}
|
2025-09-18 15:23:09 +08:00
|
|
|
|
}
|
2025-09-18 11:20:55 +08:00
|
|
|
|
//执行一次
|
2025-09-18 10:47:37 +08:00
|
|
|
|
@Override
|
|
|
|
|
|
public void doSomeThing() {
|
2025-09-18 21:03:36 +08:00
|
|
|
|
log.info("===============begin BattleRootTask=========={}==========",this.getRoomStatus());
|
2025-09-18 15:23:09 +08:00
|
|
|
|
this.initBean();
|
|
|
|
|
|
if(this.getRoomStatus()) {
|
2025-09-18 17:30:12 +08:00
|
|
|
|
long initDuringTime = this.getDuringTime();
|
2025-09-20 15:07:48 +08:00
|
|
|
|
redisUtil.hset(scenarioTask.getScenarioId() + "-" + roomId + "-" + scenarioTask.getResourceId(),"duringTime",String.valueOf(initDuringTime));
|
2025-09-20 14:28:08 +08:00
|
|
|
|
String jsonStr = (String)redisUtil.hget(scenarioTask.getScenarioId() + "-" + roomId + "-" + scenarioTask.getResourceId(),"scenarioInfo");
|
|
|
|
|
|
ScenarioInfo scenarioInfo =JSONObject.parseObject(jsonStr,ScenarioInfo.class);
|
|
|
|
|
|
HashMap<String,Object> battleParams = new HashMap<>();
|
2025-09-18 15:23:09 +08:00
|
|
|
|
//初始化本次战斗任务各种资源数
|
2025-09-20 14:28:08 +08:00
|
|
|
|
battleParams.put("ammunition",Double.valueOf(scenarioInfo.getAmmunition().getTotal()).toString());
|
|
|
|
|
|
battleParams.put("food",Double.valueOf(scenarioInfo.getFood().getTotal()).toString());
|
|
|
|
|
|
battleParams.put("fuel",Double.valueOf(scenarioInfo.getFuel().getTotal()).toString());
|
|
|
|
|
|
battleParams.put("medical",Double.valueOf(scenarioInfo.getMedical().getTotal()).toString());
|
|
|
|
|
|
battleParams.put("water",Double.valueOf(scenarioInfo.getWater().getTotal()).toString());
|
|
|
|
|
|
battleParams.put("person",Integer.valueOf(scenarioInfo.getPerson().getTotal()).toString());
|
|
|
|
|
|
battleParams.put("death",Integer.valueOf(scenarioInfo.getPerson().getDeath()).toString());
|
|
|
|
|
|
battleParams.put("injured",Integer.valueOf(scenarioInfo.getPerson().getInjured()).toString());
|
|
|
|
|
|
battleParams.put("teamLat",scenarioInfo.getTeam().getLat().toString());
|
|
|
|
|
|
battleParams.put("teamLng",scenarioInfo.getTeam().getLng().toString());
|
2025-09-18 21:03:36 +08:00
|
|
|
|
battleParams.put("duringTime",Long.valueOf(initDuringTime).toString());
|
2025-09-18 16:19:42 +08:00
|
|
|
|
log.info("===============================初始化本次战斗任务各种资源数====================================");
|
2025-09-20 15:07:48 +08:00
|
|
|
|
double suppleAmount =scenarioInfo.getAmmunition().getTotal();
|
|
|
|
|
|
int suppleDeath =scenarioInfo.getPerson().getDeath();
|
|
|
|
|
|
int suppleInjured =scenarioInfo.getPerson().getInjured();
|
2025-09-18 22:51:44 +08:00
|
|
|
|
final Map<String,Boolean> suppleFlagMap = new HashMap<>();
|
|
|
|
|
|
suppleFlagMap.put("ammunition",false);
|
2025-09-19 11:18:01 +08:00
|
|
|
|
suppleFlagMap.put("death",false);
|
|
|
|
|
|
suppleFlagMap.put("injured",false);
|
2025-09-18 15:23:09 +08:00
|
|
|
|
//定时检查统计各种资源消耗量
|
2025-09-18 17:30:12 +08:00
|
|
|
|
this.createBattleTaskOnTimingHandle(new BizTaskOnTiming() {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void execTask() {
|
|
|
|
|
|
log.info("===============================定时检查统计各种资源消耗量 begin====================================");
|
2025-09-19 11:18:01 +08:00
|
|
|
|
Long deathConsume = null;
|
|
|
|
|
|
Long injuredConsume = null;
|
2025-09-18 17:30:12 +08:00
|
|
|
|
Double ammunitionConsume = null;
|
|
|
|
|
|
Double foodConsume = null;
|
|
|
|
|
|
Double waterConsume = null;
|
|
|
|
|
|
Double fuelConsume = null;
|
|
|
|
|
|
Double medicalConsume = null;
|
2025-09-18 22:51:44 +08:00
|
|
|
|
String teamLat = null;
|
|
|
|
|
|
String teamLng = null;
|
2025-09-18 17:30:12 +08:00
|
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
|
|
|
try {
|
|
|
|
|
|
long duringTime = getDuringTime();
|
2025-09-20 15:07:48 +08:00
|
|
|
|
long lastDuringTime = Long.valueOf(redisUtil.hget(scenarioTask.getScenarioId() + "-" + roomId + "-" + scenarioTask.getResourceId(),"duringTime").toString());
|
2025-09-18 17:30:12 +08:00
|
|
|
|
long intervalDuringTime = duringTime - lastDuringTime;
|
2025-09-18 21:03:36 +08:00
|
|
|
|
double ammunition = Double.valueOf(battleParams.get("ammunition").toString());
|
|
|
|
|
|
double food = Double.valueOf(battleParams.get("food").toString());
|
|
|
|
|
|
double fuel = Double.valueOf(battleParams.get("fuel").toString());
|
|
|
|
|
|
double medical = Double.valueOf(battleParams.get("medical").toString());
|
|
|
|
|
|
double water = Double.valueOf(battleParams.get("water").toString());
|
2025-09-19 11:18:01 +08:00
|
|
|
|
long death = Long.valueOf(battleParams.get("death").toString());
|
|
|
|
|
|
long injured = Long.valueOf(battleParams.get("injured").toString());
|
2025-09-18 22:51:44 +08:00
|
|
|
|
teamLat = battleParams.get( "teamLat").toString();
|
|
|
|
|
|
teamLng = battleParams.get( "teamLng").toString();
|
2025-09-18 17:30:12 +08:00
|
|
|
|
//
|
2025-09-19 11:18:01 +08:00
|
|
|
|
deathConsume = DEATH_SPREED * intervalDuringTime;
|
|
|
|
|
|
injuredConsume = INJURED_SPREED * intervalDuringTime;
|
2025-09-18 17:30:12 +08:00
|
|
|
|
ammunitionConsume = intervalDuringTime * AMMUNITION_SPREED;
|
|
|
|
|
|
foodConsume = intervalDuringTime * FOOD_SPREED;
|
|
|
|
|
|
waterConsume = intervalDuringTime * WATER_SPREED;
|
|
|
|
|
|
fuelConsume = intervalDuringTime * FUEL_SPREED;
|
|
|
|
|
|
medicalConsume = intervalDuringTime * MEDICAL_SPREED;
|
|
|
|
|
|
|
2025-09-18 21:03:36 +08:00
|
|
|
|
battleParams.put("ammunition",Double.valueOf(ammunition - ammunitionConsume).toString());
|
|
|
|
|
|
battleParams.put("food",Double.valueOf(food - foodConsume).toString());
|
|
|
|
|
|
battleParams.put("fuel",Double.valueOf(fuel - fuelConsume).toString());
|
|
|
|
|
|
battleParams.put("medical",Double.valueOf(medical - medicalConsume).toString());
|
|
|
|
|
|
battleParams.put("water",Double.valueOf(water - waterConsume).toString());
|
2025-09-19 15:30:45 +08:00
|
|
|
|
battleParams.put("death",Long.valueOf(death+deathConsume).toString());
|
|
|
|
|
|
battleParams.put("injured",Long.valueOf(injured +injuredConsume).toString());
|
2025-09-18 21:03:36 +08:00
|
|
|
|
battleParams.put("duringTime",Long.valueOf(duringTime).toString());
|
2025-09-20 14:28:08 +08:00
|
|
|
|
|
|
|
|
|
|
scenarioInfo.getAmmunition().setCurrent(Double.valueOf(ammunition - ammunitionConsume));
|
|
|
|
|
|
scenarioInfo.getFood().setCurrent(Double.valueOf(food - foodConsume));
|
|
|
|
|
|
scenarioInfo.getFuel().setCurrent(Double.valueOf(fuel - fuelConsume));
|
|
|
|
|
|
scenarioInfo.getMedical().setCurrent(Double.valueOf(medical - medicalConsume));
|
|
|
|
|
|
scenarioInfo.getWater().setCurrent(Double.valueOf(water - waterConsume));
|
2025-09-20 14:56:17 +08:00
|
|
|
|
scenarioInfo.getPerson().setDeath(Long.valueOf(death+deathConsume).intValue());
|
|
|
|
|
|
scenarioInfo.getPerson().setInjured(Long.valueOf(injured +injuredConsume).intValue());
|
2025-09-20 15:07:48 +08:00
|
|
|
|
redisUtil.hset(scenarioTask.getScenarioId() + "-" + roomId + "-" + scenarioTask.getResourceId(),"duringTime",String.valueOf(duringTime));
|
|
|
|
|
|
redisUtil.hset(scenarioTask.getScenarioId() + "-" + roomId + "-" + scenarioTask.getResourceId(), "scenarioInfo",JSONObject.toJSONString(scenarioInfo));
|
2025-09-18 17:30:12 +08:00
|
|
|
|
}catch (Exception ex){
|
|
|
|
|
|
log.error("==============================设置消耗信息失败=============================================",ex.getMessage());
|
|
|
|
|
|
}
|
|
|
|
|
|
try {
|
|
|
|
|
|
//推送消耗數據
|
2025-09-19 20:20:34 +08:00
|
|
|
|
ResponseCmdInfo<String> sendConsumeMsg = new ResponseCmdInfo<>();
|
2025-09-19 11:18:01 +08:00
|
|
|
|
jsonObject.put("deathConsume", deathConsume);
|
|
|
|
|
|
jsonObject.put("injuredConsume", injuredConsume);
|
2025-09-18 17:30:12 +08:00
|
|
|
|
jsonObject.put("ammunitionConsume", ammunitionConsume);
|
|
|
|
|
|
jsonObject.put("foodConsume", foodConsume);
|
|
|
|
|
|
jsonObject.put("waterConsume", waterConsume);
|
|
|
|
|
|
jsonObject.put("fuelConsume", fuelConsume);
|
|
|
|
|
|
jsonObject.put("medicalConsume", medicalConsume);
|
2025-09-18 22:51:44 +08:00
|
|
|
|
jsonObject.put("teamLat",teamLat);
|
|
|
|
|
|
jsonObject.put("teamLng",teamLng);
|
2025-09-19 16:35:52 +08:00
|
|
|
|
jsonObject.put("resourceId",scenarioTask.getResourceId());
|
2025-09-19 20:06:32 +08:00
|
|
|
|
LocalDateTime currentDateTime = new Date().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
|
|
|
|
|
|
jsonObject.put("consumeDate",currentDateTime);
|
2025-09-19 20:20:34 +08:00
|
|
|
|
sendConsumeMsg.setData(jsonObject.toString());
|
2025-09-19 16:30:13 +08:00
|
|
|
|
sendConsumeMsg.setRoom(roomId);
|
|
|
|
|
|
sendConsumeMsg.setScenarioId(scenarioTask.getScenarioId());
|
|
|
|
|
|
sendConsumeMsg.setCmdType("battleConsume");
|
2025-09-18 17:30:12 +08:00
|
|
|
|
Global.sendCmdInfoQueue.add(sendConsumeMsg);
|
2025-09-19 15:05:41 +08:00
|
|
|
|
BattleConsume battleConsume = new BattleConsume();
|
|
|
|
|
|
battleConsume.setLat(teamLat);
|
|
|
|
|
|
battleConsume.setLng(teamLng);
|
|
|
|
|
|
battleConsume.setId(IdUtils.simpleUUID());
|
|
|
|
|
|
battleConsume.setAmmunition(ammunitionConsume);
|
2025-09-19 15:43:17 +08:00
|
|
|
|
battleConsume.setDeath(Integer.valueOf(Double.valueOf(deathConsume).intValue()));
|
|
|
|
|
|
battleConsume.setInjured(Integer.valueOf(Double.valueOf(injuredConsume).intValue()));
|
2025-09-19 15:05:41 +08:00
|
|
|
|
battleConsume.setFood(foodConsume);
|
|
|
|
|
|
battleConsume.setFuel(fuelConsume);
|
|
|
|
|
|
battleConsume.setMedical(medicalConsume);
|
|
|
|
|
|
battleConsume.setWater(waterConsume);
|
|
|
|
|
|
battleConsume.setResourceId(scenarioTask.getResourceId());
|
2025-09-19 20:02:02 +08:00
|
|
|
|
battleConsume.setConsumeDate(currentDateTime);
|
2025-09-19 15:05:41 +08:00
|
|
|
|
battleConsumeService.save(battleConsume);
|
2025-09-18 17:30:12 +08:00
|
|
|
|
}catch (Exception ex){
|
2025-09-19 15:30:45 +08:00
|
|
|
|
ex.printStackTrace();
|
2025-09-18 17:30:12 +08:00
|
|
|
|
log.error("==================推送消耗數據 失败============================================",ex.getMessage());
|
|
|
|
|
|
}
|
2025-09-18 16:19:42 +08:00
|
|
|
|
|
2025-09-18 17:30:12 +08:00
|
|
|
|
try {
|
|
|
|
|
|
LocalDateTime currentDateTime = new Date().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
|
2025-09-19 15:05:41 +08:00
|
|
|
|
String death = SpringUtil.getBean(Environment.class).getProperty("death.warn");
|
|
|
|
|
|
String injured = SpringUtil.getBean(Environment.class).getProperty("injured.warn");
|
|
|
|
|
|
String ammunition = SpringUtil.getBean(Environment.class).getProperty("ammunition.warn");
|
2025-09-19 11:18:01 +08:00
|
|
|
|
log.info("===========person ammunition==={}===={}====={}========",death,injured,ammunition);
|
2025-09-19 15:05:41 +08:00
|
|
|
|
HashMap<String,Object> battleConsumeMap = (HashMap<String, Object>) redisUtil.hget(scenarioTask.getScenarioId() + "-" + roomId + "-" + scenarioTask.getResourceId());
|
|
|
|
|
|
Double restAmmunition = Double.valueOf(battleConsumeMap.get("ammunition").toString());
|
|
|
|
|
|
StatisticBean battleResourceStat = statisticService.statistic(scenarioTask.getResourceId());
|
|
|
|
|
|
Double ammunitionConsumeRate = restAmmunition/battleResourceStat.getAmmunition().getTotal()*100;
|
|
|
|
|
|
if(Double.valueOf(ammunitionConsumeRate) <= Double.valueOf(ammunition) && suppleFlagMap.get("ammunition") == false){
|
2025-09-18 22:51:44 +08:00
|
|
|
|
SupplierRequest supplierRequest = new SupplierRequest();
|
|
|
|
|
|
supplierRequest.setId(IdUtils.simpleUUID());
|
|
|
|
|
|
supplierRequest.setFromResourceId(scenarioTask.getResourceId());
|
2025-09-19 12:29:25 +08:00
|
|
|
|
supplierRequest.setSupplierNum(String.valueOf(suppleAmount));
|
2025-09-18 22:51:44 +08:00
|
|
|
|
supplierRequest.setSupplierType("ammunition");
|
|
|
|
|
|
supplierRequest.setGeneralTime(currentDateTime);
|
|
|
|
|
|
supplierRequest.setLat(jsonObject.get("teamLat").toString());
|
|
|
|
|
|
supplierRequest.setLng(jsonObject.get("teamLng").toString());
|
|
|
|
|
|
supplierRequestService.save(supplierRequest);
|
2025-09-19 20:20:34 +08:00
|
|
|
|
ResponseCmdInfo<String> respObj = new ResponseCmdInfo<>();
|
|
|
|
|
|
respObj.setData(JSON.toJSONString(supplierRequest));
|
|
|
|
|
|
respObj.setRoom(roomId);
|
|
|
|
|
|
respObj.setScenarioId(scenarioTask.getScenarioId());
|
2025-09-20 09:16:27 +08:00
|
|
|
|
respObj.setCmdType("");
|
2025-09-19 20:20:34 +08:00
|
|
|
|
Global.sendCmdInfoQueue.add(respObj);
|
2025-09-18 22:51:44 +08:00
|
|
|
|
suppleFlagMap.put("ammunition",true) ;
|
|
|
|
|
|
}
|
2025-09-19 15:30:45 +08:00
|
|
|
|
Long restDeath = Long.valueOf(battleConsumeMap.get("death").toString());
|
2025-09-20 09:16:27 +08:00
|
|
|
|
Long deathConsumeRate = 0L;
|
|
|
|
|
|
if(battleResourceStat.getPerson().getTotal() !=0) {
|
|
|
|
|
|
deathConsumeRate = restDeath * 100 / battleResourceStat.getPerson().getTotal();
|
|
|
|
|
|
}
|
2025-09-19 15:30:45 +08:00
|
|
|
|
if(deathConsumeRate >= Long.valueOf(death) && suppleFlagMap.get("death") == false){
|
2025-09-19 11:18:01 +08:00
|
|
|
|
SupplierRequest supplierRequest = new SupplierRequest();
|
|
|
|
|
|
supplierRequest.setId(IdUtils.simpleUUID());
|
|
|
|
|
|
supplierRequest.setFromResourceId(scenarioTask.getResourceId());
|
2025-09-19 12:29:25 +08:00
|
|
|
|
supplierRequest.setSupplierNum(String.valueOf(suppleDeath));
|
2025-09-19 11:18:01 +08:00
|
|
|
|
supplierRequest.setSupplierType("death");
|
|
|
|
|
|
supplierRequest.setGeneralTime(currentDateTime);
|
|
|
|
|
|
supplierRequest.setLat(jsonObject.get("teamLat").toString());
|
|
|
|
|
|
supplierRequest.setLng(jsonObject.get("teamLng").toString());
|
|
|
|
|
|
supplierRequestService.save(supplierRequest);
|
2025-09-19 20:20:34 +08:00
|
|
|
|
ResponseCmdInfo<String> respObj = new ResponseCmdInfo<>();
|
|
|
|
|
|
respObj.setData(JSON.toJSONString(supplierRequest));
|
|
|
|
|
|
respObj.setRoom(roomId);
|
|
|
|
|
|
respObj.setScenarioId(scenarioTask.getScenarioId());
|
|
|
|
|
|
Global.sendCmdInfoQueue.add(respObj);
|
2025-09-19 11:18:01 +08:00
|
|
|
|
suppleFlagMap.put("death",true) ;
|
|
|
|
|
|
}
|
2025-09-19 15:30:45 +08:00
|
|
|
|
Long restInjured = Long.valueOf(battleConsumeMap.get("injured").toString());
|
|
|
|
|
|
Long injuredConsumeRate = restInjured*100/battleResourceStat.getPerson().getTotal();
|
2025-09-19 15:05:41 +08:00
|
|
|
|
if(Long.valueOf(injuredConsumeRate) <= Long.valueOf(injured) && suppleFlagMap.get("injured") == false){
|
2025-09-18 17:30:12 +08:00
|
|
|
|
SupplierRequest supplierRequest = new SupplierRequest();
|
2025-09-18 21:03:36 +08:00
|
|
|
|
supplierRequest.setId(IdUtils.simpleUUID());
|
2025-09-18 17:30:12 +08:00
|
|
|
|
supplierRequest.setFromResourceId(scenarioTask.getResourceId());
|
2025-09-19 12:29:25 +08:00
|
|
|
|
supplierRequest.setSupplierNum(String.valueOf(suppleInjured));
|
2025-09-19 11:18:01 +08:00
|
|
|
|
supplierRequest.setSupplierType("injured");
|
2025-09-18 17:30:12 +08:00
|
|
|
|
supplierRequest.setGeneralTime(currentDateTime);
|
2025-09-18 22:51:44 +08:00
|
|
|
|
supplierRequest.setLat(jsonObject.get("teamLat").toString());
|
|
|
|
|
|
supplierRequest.setLng(jsonObject.get("teamLng").toString());
|
|
|
|
|
|
supplierRequestService.save(supplierRequest);
|
2025-09-19 20:20:34 +08:00
|
|
|
|
ResponseCmdInfo<String> respObj = new ResponseCmdInfo<>();
|
|
|
|
|
|
respObj.setData(JSON.toJSONString(supplierRequest));
|
|
|
|
|
|
respObj.setRoom(roomId);
|
|
|
|
|
|
respObj.setScenarioId(scenarioTask.getScenarioId());
|
|
|
|
|
|
Global.sendCmdInfoQueue.add(respObj);
|
2025-09-19 11:18:01 +08:00
|
|
|
|
suppleFlagMap.put("injured",true) ;
|
2025-09-18 17:30:12 +08:00
|
|
|
|
}
|
|
|
|
|
|
}catch (Exception ex){
|
2025-09-18 21:03:36 +08:00
|
|
|
|
ex.printStackTrace();
|
2025-09-18 17:30:12 +08:00
|
|
|
|
log.error("===========BattleRootTask supplierRequestService.saveBatch error====================",ex.getMessage());
|
2025-09-18 16:19:42 +08:00
|
|
|
|
}
|
2025-09-18 17:30:12 +08:00
|
|
|
|
log.info("===============================定时检查统计各种资源消耗量 end====================================");
|
2025-09-18 16:19:42 +08:00
|
|
|
|
}
|
2025-09-18 17:30:12 +08:00
|
|
|
|
});
|
|
|
|
|
|
|
2025-09-18 15:23:09 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-09-18 10:47:37 +08:00
|
|
|
|
}
|
2025-09-18 11:41:46 +08:00
|
|
|
|
|
|
|
|
|
|
|
2025-09-18 10:47:37 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|