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