Merge branch 'main' of http://git.hivekion.com:3000/liyudong/simulation-backend
This commit is contained in:
commit
c5f5136314
|
|
@ -41,7 +41,6 @@ import java.util.concurrent.TimeUnit;
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class BattleRootTask extends AbtParentTask {
|
public class BattleRootTask extends AbtParentTask {
|
||||||
|
|
||||||
private StatisticService statisticService = null;
|
|
||||||
private RedisUtil redisUtil = null;
|
private RedisUtil redisUtil = null;
|
||||||
|
|
||||||
private ISupplierRequestService supplierRequestService;
|
private ISupplierRequestService supplierRequestService;
|
||||||
|
|
@ -63,9 +62,7 @@ public class BattleRootTask extends AbtParentTask {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initBean(){
|
private void initBean(){
|
||||||
if(statisticService == null) {
|
|
||||||
statisticService = SpringUtil.getBean(StatisticService.class);
|
|
||||||
}
|
|
||||||
if(redisUtil == null) {
|
if(redisUtil == null) {
|
||||||
redisUtil = SpringUtil.getBean(RedisUtil.class);
|
redisUtil = SpringUtil.getBean(RedisUtil.class);
|
||||||
}
|
}
|
||||||
|
|
@ -210,10 +207,11 @@ public class BattleRootTask extends AbtParentTask {
|
||||||
String injured = SpringUtil.getBean(Environment.class).getProperty("injured.warn");
|
String injured = SpringUtil.getBean(Environment.class).getProperty("injured.warn");
|
||||||
String ammunition = SpringUtil.getBean(Environment.class).getProperty("ammunition.warn");
|
String ammunition = SpringUtil.getBean(Environment.class).getProperty("ammunition.warn");
|
||||||
log.info("===========person ammunition==={}===={}====={}========",death,injured,ammunition);
|
log.info("===========person ammunition==={}===={}====={}========",death,injured,ammunition);
|
||||||
HashMap<String,Object> battleConsumeMap = (HashMap<String, Object>) redisUtil.hget(scenarioTask.getScenarioId() + "-" + roomId + "-" + scenarioTask.getResourceId());
|
String saveJsonStr= (String) redisUtil.hget(scenarioTask.getScenarioId() + "-" + roomId + "-" + scenarioTask.getResourceId(),"scenarioInfo");
|
||||||
Double restAmmunition = Double.valueOf(battleConsumeMap.get("ammunition").toString());
|
ScenarioInfo scenarioInfo =JSONObject.parseObject(saveJsonStr,ScenarioInfo.class);
|
||||||
StatisticBean battleResourceStat = statisticService.statistic(scenarioTask.getResourceId());
|
Double restAmmunition = Double.valueOf(scenarioInfo.getAmmunition().getCurrent());
|
||||||
Double ammunitionConsumeRate = restAmmunition/battleResourceStat.getAmmunition().getTotal()*100;
|
// StatisticBean battleResourceStat = statisticService.statistic(scenarioTask.getResourceId());
|
||||||
|
Double ammunitionConsumeRate = restAmmunition/scenarioInfo.getAmmunition().getTotal()*100;
|
||||||
if(Double.valueOf(ammunitionConsumeRate) <= Double.valueOf(ammunition) && suppleFlagMap.get("ammunition") == false){
|
if(Double.valueOf(ammunitionConsumeRate) <= Double.valueOf(ammunition) && suppleFlagMap.get("ammunition") == false){
|
||||||
SupplierRequest supplierRequest = new SupplierRequest();
|
SupplierRequest supplierRequest = new SupplierRequest();
|
||||||
supplierRequest.setId(IdUtils.simpleUUID());
|
supplierRequest.setId(IdUtils.simpleUUID());
|
||||||
|
|
@ -232,10 +230,10 @@ public class BattleRootTask extends AbtParentTask {
|
||||||
Global.sendCmdInfoQueue.add(respObj);
|
Global.sendCmdInfoQueue.add(respObj);
|
||||||
suppleFlagMap.put("ammunition",true) ;
|
suppleFlagMap.put("ammunition",true) ;
|
||||||
}
|
}
|
||||||
Long restDeath = Long.valueOf(battleConsumeMap.get("death").toString());
|
Long restDeath = Long.valueOf(scenarioInfo.getPerson().getDeath());
|
||||||
Long deathConsumeRate = 0L;
|
Long deathConsumeRate = 0L;
|
||||||
if(battleResourceStat.getPerson().getTotal() !=0) {
|
if(scenarioInfo.getPerson().getTotal() !=0) {
|
||||||
deathConsumeRate = restDeath * 100 / battleResourceStat.getPerson().getTotal();
|
deathConsumeRate = restDeath * 100 / scenarioInfo.getPerson().getTotal();
|
||||||
}
|
}
|
||||||
if(deathConsumeRate >= Long.valueOf(death) && suppleFlagMap.get("death") == false){
|
if(deathConsumeRate >= Long.valueOf(death) && suppleFlagMap.get("death") == false){
|
||||||
SupplierRequest supplierRequest = new SupplierRequest();
|
SupplierRequest supplierRequest = new SupplierRequest();
|
||||||
|
|
@ -254,8 +252,8 @@ public class BattleRootTask extends AbtParentTask {
|
||||||
Global.sendCmdInfoQueue.add(respObj);
|
Global.sendCmdInfoQueue.add(respObj);
|
||||||
suppleFlagMap.put("death",true) ;
|
suppleFlagMap.put("death",true) ;
|
||||||
}
|
}
|
||||||
Long restInjured = Long.valueOf(battleConsumeMap.get("injured").toString());
|
Long restInjured = Long.valueOf(scenarioInfo.getPerson().getInjured());
|
||||||
Long injuredConsumeRate = restInjured*100/battleResourceStat.getPerson().getTotal();
|
Long injuredConsumeRate = restInjured*100/scenarioInfo.getPerson().getTotal();
|
||||||
if(Long.valueOf(injuredConsumeRate) <= Long.valueOf(injured) && suppleFlagMap.get("injured") == false){
|
if(Long.valueOf(injuredConsumeRate) <= Long.valueOf(injured) && suppleFlagMap.get("injured") == false){
|
||||||
SupplierRequest supplierRequest = new SupplierRequest();
|
SupplierRequest supplierRequest = new SupplierRequest();
|
||||||
supplierRequest.setId(IdUtils.simpleUUID());
|
supplierRequest.setId(IdUtils.simpleUUID());
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user