Merge branch 'main' of http://git.hivekion.com:3000/liyudong/simulation-backend
This commit is contained in:
commit
45a832f777
|
|
@ -1,8 +1,23 @@
|
|||
package com.hivekion.baseData.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import com.hivekion.baseData.domain.tblvehicleVo.VehicleAddInputVo;
|
||||
import com.hivekion.baseData.entity.WeatherResource;
|
||||
import com.hivekion.baseData.service.IWeatherResourceService;
|
||||
import com.hivekion.common.annotation.AutoLog;
|
||||
import com.hivekion.common.entity.PagedResultVo;
|
||||
import com.hivekion.common.entity.ResponseData;
|
||||
import com.hivekion.common.enums.OperationTypeEnum;
|
||||
import com.hivekion.common.enums.ResultCodeEnum;
|
||||
import com.hivekion.environment.entity.SimtoolEbe;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.stereotype.Controller;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 气像资源信息 前端控制器
|
||||
|
|
@ -11,8 +26,53 @@ import org.springframework.stereotype.Controller;
|
|||
* @author liDongYu
|
||||
* @since 2025-09-14
|
||||
*/
|
||||
@Controller
|
||||
@RestController
|
||||
@RequestMapping("/baseData/weatherResource")
|
||||
public class WeatherResourceController {
|
||||
public class WeatherResourceController extends BaseController{
|
||||
|
||||
@Resource
|
||||
private IWeatherResourceService weatherResourceService;
|
||||
|
||||
@PostMapping("/add")
|
||||
@ApiOperation(value = "新增天气信息", notes = "")
|
||||
@AutoLog(value = "新增天气信息", operationType = OperationTypeEnum.INSERT, module = "基础数据/新增车辆信息")
|
||||
public boolean add(@RequestBody WeatherResource inputVo) throws Exception {
|
||||
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
LocalDateTime begDate = LocalDateTime.parse(inputVo.getLastBegTimeStr(),dtf);
|
||||
LocalDateTime endDate = LocalDateTime.parse(inputVo.getLastEndTimeStr(),dtf);
|
||||
inputVo.setLastBegTime(begDate);
|
||||
inputVo.setLastEndTime(endDate);
|
||||
return weatherResourceService.save(inputVo);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询天气列表", notes = "")
|
||||
@GetMapping("/list")
|
||||
|
||||
public PagedResultVo<WeatherResource> list(WeatherResource search) {
|
||||
|
||||
|
||||
//设置开始索引
|
||||
search.setStart(search.getPageSize() * (search.getPageNum() - 1));
|
||||
//查询结果列表
|
||||
List<WeatherResource> list = weatherResourceService.list(search);
|
||||
//查询总数
|
||||
Long total = weatherResourceService.count(search);
|
||||
return list(search, list, total);
|
||||
|
||||
}
|
||||
/**
|
||||
* 删除天气数据
|
||||
*
|
||||
* @param id 记录ID
|
||||
* @return 操作结果
|
||||
*/
|
||||
@GetMapping("/remove/{id}")
|
||||
public ResponseData<Void> remove(@PathVariable("id") Integer id) {
|
||||
WeatherResource weather = weatherResourceService.getById(id);
|
||||
if (weather == null) {
|
||||
return ResponseData.error(ResultCodeEnum.RECORD_NOT_EXIT, null);
|
||||
}
|
||||
weatherResourceService.removeById(id);
|
||||
return ResponseData.success(null);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
|||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.hivekion.common.entity.SearchInputVo;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.Serializable;
|
||||
|
|
@ -21,7 +22,7 @@ import lombok.Data;
|
|||
@TableName("TBL_WEATHER_RESOURCE")
|
||||
@ApiModel(value = "WeatherResource对象", description = "气像资源信息")
|
||||
@Data
|
||||
public class WeatherResource implements Serializable {
|
||||
public class WeatherResource extends SearchInputVo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
|
@ -51,5 +52,10 @@ public class WeatherResource implements Serializable {
|
|||
@TableField(exist = false)
|
||||
private String status = "init";
|
||||
|
||||
@TableField(exist = false)
|
||||
private String lastBegTimeStr;
|
||||
@TableField(exist = false)
|
||||
private String lastEndTimeStr;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,9 @@ package com.hivekion.baseData.mapper;
|
|||
|
||||
import com.hivekion.baseData.entity.WeatherResource;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.hivekion.environment.entity.SimtoolEbe;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
|
@ -13,4 +16,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||
*/
|
||||
public interface WeatherResourceMapper extends BaseMapper<WeatherResource> {
|
||||
|
||||
List<WeatherResource> list(WeatherResource ebe);
|
||||
|
||||
Long count(WeatherResource ebe);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,9 @@ package com.hivekion.baseData.service;
|
|||
|
||||
import com.hivekion.baseData.entity.WeatherResource;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.hivekion.environment.entity.SimtoolEbe;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
|
@ -13,4 +16,9 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||
*/
|
||||
public interface IWeatherResourceService extends IService<WeatherResource> {
|
||||
|
||||
List<WeatherResource> list(WeatherResource ebe);
|
||||
|
||||
Long count(WeatherResource ebe);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,14 @@
|
|||
package com.hivekion.baseData.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.hivekion.baseData.entity.WeatherResource;
|
||||
import com.hivekion.baseData.mapper.WeatherResourceMapper;
|
||||
import com.hivekion.baseData.service.IWeatherResourceService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 气像资源信息 服务实现类
|
||||
|
|
@ -17,4 +20,15 @@ import org.springframework.stereotype.Service;
|
|||
@Service
|
||||
public class WeatherResourceServiceImpl extends ServiceImpl<WeatherResourceMapper, WeatherResource> implements IWeatherResourceService {
|
||||
|
||||
@Override
|
||||
public List<WeatherResource> list(WeatherResource ebe) {
|
||||
|
||||
return this.list(new QueryWrapper<WeatherResource>().eq("scenario_id",ebe.getScenarioId()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long count(WeatherResource ebe) {
|
||||
return this.baseMapper.count(ebe);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ public abstract class AbtParentTask implements TaskAction {
|
|||
1);
|
||||
schedule.scheduleWithFixedDelay(() -> {
|
||||
bizTaskOnTiming.execTask();
|
||||
}, 0, 5, TimeUnit.SECONDS);
|
||||
}, 0, 1, TimeUnit.SECONDS);
|
||||
//房间统一管理定时器;房间关闭后,定时器销毁
|
||||
addScheduledExecutorServiceRefenceToRoom(schedule);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,15 +10,23 @@ import com.hivekion.common.entity.ResponseCmdInfo;
|
|||
import com.hivekion.common.redis.RedisUtil;
|
||||
import com.hivekion.common.uuid.IdUtils;
|
||||
import com.hivekion.room.RoomManager;
|
||||
import com.hivekion.room.func.TaskAction;
|
||||
import com.hivekion.scenario.entity.BattleConsume;
|
||||
import com.hivekion.scenario.entity.ScenarioResource;
|
||||
import com.hivekion.scenario.entity.ScenarioTask;
|
||||
import com.hivekion.scenario.service.IBattleConsumeService;
|
||||
import com.hivekion.scenario.service.impl.BattleSupplierServiceImpl;
|
||||
import com.hivekion.scenario.service.impl.ScenarioResourceServiceImpl;
|
||||
import com.hivekion.scenario.service.impl.ScenarioTaskServiceImpl;
|
||||
import com.hivekion.statistic.bean.*;
|
||||
import com.hivekion.statistic.service.StatisticService;
|
||||
import com.hivekion.statistic.service.impl.StatisticServiceImpl;
|
||||
import com.hivekion.supplier.entity.SupplierRequest;
|
||||
import com.hivekion.supplier.service.ISupplierRequestService;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import com.hivekion.team.entity.Teaminfo;
|
||||
import com.hivekion.team.service.impl.TeaminfoServiceImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
|
@ -49,6 +57,7 @@ public class BattleRootTask extends AbtParentTask {
|
|||
|
||||
private IBattleConsumeService battleConsumeService;
|
||||
|
||||
private ScenarioInfo scenarioInfo;
|
||||
|
||||
private static final Double FOOD_SPREED = 0.3D;
|
||||
private static final Double WATER_SPREED = 0.1D;
|
||||
|
|
@ -83,7 +92,7 @@ public class BattleRootTask extends AbtParentTask {
|
|||
redisUtil.hset(scenarioTask.getScenarioId() + "-" + roomId + "-" + scenarioTask.getResourceId(),"duringTime",String.valueOf(initDuringTime));
|
||||
String jsonStr = (String)redisUtil.hget(scenarioTask.getScenarioId() + "-" + roomId + "-" + scenarioTask.getResourceId(),"scenarioInfo");
|
||||
ScenarioInfo scenarioInfo =JSONObject.parseObject(jsonStr,ScenarioInfo.class);
|
||||
|
||||
this.scenarioInfo = scenarioInfo;
|
||||
log.info("===============================初始化本次战斗任务各种资源数====================================");
|
||||
double suppleAmount =scenarioInfo.getAmmunition().getTotal();
|
||||
int suppleDeath =scenarioInfo.getPerson().getDeath();
|
||||
|
|
@ -125,11 +134,11 @@ public class BattleRootTask extends AbtParentTask {
|
|||
teamLng = scenarioInfoOnTime.getTeam().getLng().toString();
|
||||
if(scenarioInfoOnTime.getPerson().getCurrent() >0) {
|
||||
//
|
||||
deathConsume = RandomUtil.getSecureRandom().nextInt(2) * intervalDuringTime* RoomManager.getMag(roomId);
|
||||
injuredConsume = RandomUtil.getSecureRandom().nextInt(3) * intervalDuringTime* RoomManager.getMag(roomId);
|
||||
ammunitionConsume = intervalDuringTime * (0.1D + RandomUtil.getSecureRandom().nextDouble())* RoomManager.getMag(roomId);
|
||||
foodConsume = intervalDuringTime * FOOD_SPREED* RoomManager.getMag(roomId);
|
||||
waterConsume = intervalDuringTime * WATER_SPREED* RoomManager.getMag(roomId);
|
||||
deathConsume = RandomUtil.getSecureRandom().nextInt(2) * intervalDuringTime;
|
||||
injuredConsume = RandomUtil.getSecureRandom().nextInt(3) * intervalDuringTime;
|
||||
ammunitionConsume = intervalDuringTime * (0.1D + RandomUtil.getSecureRandom().nextDouble());
|
||||
foodConsume = intervalDuringTime * FOOD_SPREED;
|
||||
waterConsume = intervalDuringTime * WATER_SPREED;
|
||||
|
||||
medicalConsume = intervalDuringTime * MEDICAL_SPREED* RoomManager.getMag(roomId);
|
||||
|
||||
|
|
@ -148,7 +157,7 @@ public class BattleRootTask extends AbtParentTask {
|
|||
}
|
||||
scenarioInfoOnTime.getPerson().setDeath(Long.valueOf(death + deathConsume).intValue());
|
||||
scenarioInfoOnTime.getPerson().setInjured(Long.valueOf(injured + injuredConsume).intValue());
|
||||
scenarioInfoOnTime.getPerson().setCurrent(scenarioInfo.getPerson().getCurrent() - Long.valueOf(deathConsume).intValue()-Long.valueOf(injuredConsume).intValue());
|
||||
scenarioInfoOnTime.getPerson().setCurrent(scenarioInfoOnTime.getPerson().getCurrent() - Long.valueOf(deathConsume).intValue()-Long.valueOf(injuredConsume).intValue());
|
||||
|
||||
String updJsonStr = (String) redisUtil.hget(scenarioTask.getScenarioId() + "-" + roomId + "-" + scenarioTask.getResourceId(), "updScenarioInfo");
|
||||
EditScenarioInfo updScenarioInfo = JSON.parseObject(updJsonStr, EditScenarioInfo.class);
|
||||
|
|
@ -178,6 +187,26 @@ public class BattleRootTask extends AbtParentTask {
|
|||
Global.sendCmdInfoQueue.add(respObj);
|
||||
redisUtil.hset(scenarioTask.getScenarioId() + "-" + roomId + "-" + scenarioTask.getResourceId(), "duringTime", String.valueOf(duringTime));
|
||||
redisUtil.hset(scenarioTask.getScenarioId() + "-" + roomId + "-" + scenarioTask.getResourceId(), "scenarioInfo", JSONObject.toJSONString(scenarioInfoOnTime));
|
||||
}else{
|
||||
log.info("=========================scenarioInfoOnTime.getPerson().getCurrent()==========={}========================================================",scenarioInfoOnTime.getPerson().getCurrent());
|
||||
String updJsonStr = (String) redisUtil.hget(scenarioTask.getScenarioId() + "-" + roomId + "-" + scenarioTask.getResourceId(), "updScenarioInfo");
|
||||
EditScenarioInfo updScenarioInfo = JSON.parseObject(updJsonStr, EditScenarioInfo.class);
|
||||
if(updScenarioInfo.getJbxx().getAmmunition().getCurrent() <0) {
|
||||
updScenarioInfo.getJbxx().getAmmunition().setCurrent(Double.valueOf(0));
|
||||
}
|
||||
if(updScenarioInfo.getJbxx().getFood().getCurrent() < 0) {
|
||||
updScenarioInfo.getJbxx().getFood().setCurrent(Double.valueOf(0));
|
||||
}
|
||||
// updScenarioInfo.getJbxx().getFuel().setCurrent(Double.valueOf(fuel - fuelConsume));
|
||||
if(updScenarioInfo.getJbxx().getMedical().getCurrent() < 0) {
|
||||
updScenarioInfo.getJbxx().getMedical().setCurrent(Double.valueOf(0));
|
||||
}
|
||||
if(updScenarioInfo.getJbxx().getWater().getCurrent() < 0) {
|
||||
updScenarioInfo.getJbxx().getWater().setCurrent(Double.valueOf(0));
|
||||
}
|
||||
updScenarioInfo.getJbxx().getPerson().setCurrent(0);
|
||||
redisUtil.hset(scenarioTask.getScenarioId() + "-" + roomId + "-" + scenarioTask.getResourceId(),
|
||||
"updScenarioInfo", JSON.toJSONString(updScenarioInfo));
|
||||
}
|
||||
}catch (Exception ex){
|
||||
ex.printStackTrace();
|
||||
|
|
@ -290,7 +319,7 @@ public class BattleRootTask extends AbtParentTask {
|
|||
SupplierRequest supplierRequest = new SupplierRequest();
|
||||
supplierRequest.setId(IdUtils.simpleUUID());
|
||||
supplierRequest.setFromResourceId(scenarioTask.getResourceId());
|
||||
supplierRequest.setSupplierNum(String.valueOf(suppleInjured));
|
||||
supplierRequest.setSupplierNum(String.valueOf(scenarioInfoOnTime.getPerson().getInjured()));
|
||||
supplierRequest.setSupplierType("injured");
|
||||
supplierRequest.setGeneralTime(currentDateTime);
|
||||
supplierRequest.setLat(jsonObject.get("teamLat").toString());
|
||||
|
|
@ -302,6 +331,18 @@ public class BattleRootTask extends AbtParentTask {
|
|||
respObj.setScenarioId(scenarioTask.getScenarioId());
|
||||
respObj.setCmdType("injuredRequest");
|
||||
Global.sendCmdInfoQueue.add(respObj);
|
||||
log.info("================================begin injured Supplier Task=====================================");
|
||||
produceTask(scenarioInfoOnTime.getPerson().getInjured());
|
||||
String jsonInjured = (String)redisUtil.hget(scenarioTask.getScenarioId() + "-" + roomId + "-" + scenarioTask.getResourceId(),"scenarioInfo");
|
||||
ScenarioInfo scenarioInfoInjured =JSONObject.parseObject(jsonInjured,ScenarioInfo.class);
|
||||
scenarioInfoInjured.getPerson().setInjured(Long.valueOf(0).intValue());
|
||||
redisUtil.hset(scenarioTask.getScenarioId() + "-" + roomId + "-" + scenarioTask.getResourceId(), "scenarioInfo", JSONObject.toJSONString(scenarioInfoInjured));
|
||||
String updJsonStr = (String) redisUtil.hget(scenarioTask.getScenarioId() + "-" + roomId + "-" + scenarioTask.getResourceId(), "updScenarioInfo");
|
||||
EditScenarioInfo updScenarioInfo = JSON.parseObject(updJsonStr, EditScenarioInfo.class);
|
||||
updScenarioInfo.getJbxx().getPerson().setInjured(Long.valueOf(0).intValue());
|
||||
redisUtil.hset(scenarioTask.getScenarioId() + "-" + roomId + "-" + scenarioTask.getResourceId(),
|
||||
"updScenarioInfo", JSON.toJSONString(updScenarioInfo));
|
||||
log.info("================================end injured Supplier Task=====================================");
|
||||
suppleFlagMap.put("injured", true);
|
||||
}
|
||||
}
|
||||
|
|
@ -318,6 +359,109 @@ public class BattleRootTask extends AbtParentTask {
|
|||
}
|
||||
|
||||
|
||||
private void produceTask(Integer injured) {
|
||||
try {
|
||||
Map<Integer, Teaminfo> teamInfoMap = SpringUtil.getBean(TeaminfoServiceImpl.class)
|
||||
.teamInfoMap();
|
||||
|
||||
log.info("{}-产生自动保障任务", this.scenarioTask.getResourceId());
|
||||
List<ScenarioResource> resourceList = SpringUtil.getBean(BattleSupplierServiceImpl.class)
|
||||
.selectSupplierResource(scenarioTask.getResourceId());
|
||||
log.info("{}-可选保障分队长度{}", scenarioTask.getResourceId(), resourceList.size());
|
||||
if (!resourceList.isEmpty()) {
|
||||
ScenarioResource supplierResource = null;
|
||||
// 找出油料保障分队
|
||||
for (ScenarioResource resource : resourceList) {
|
||||
|
||||
|
||||
Teaminfo teaminfo = teamInfoMap.get(resource.getResourceId());
|
||||
|
||||
if ("HOSPITAL".equals(teaminfo.getRoleCode())) {
|
||||
supplierResource = resource;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (supplierResource == null) {
|
||||
log.error("找不到对应的医院分队");
|
||||
return;
|
||||
}
|
||||
//找出医院
|
||||
List<ScenarioResource> resources = SpringUtil.getBean(ScenarioResourceServiceImpl.class)
|
||||
.selectResourceByRoleCode(scenarioTask.getScenarioId(), "HOSPITAL");
|
||||
if (resources.isEmpty()) {
|
||||
log.error("找不到医院仓库");
|
||||
return;
|
||||
}
|
||||
|
||||
produceMoveTask(supplierResource, resources.get(0), this.coordinateReference.get(), injured);
|
||||
|
||||
|
||||
} else {
|
||||
log.error("{}-没有保障分队可以选择", scenarioTask.getResourceId());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("produceTask exception", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void produceMoveTask(ScenarioResource supplierResource, ScenarioResource fuelResource,
|
||||
Coordinate coordinate, Integer injured) {
|
||||
ScenarioTask task = new ScenarioTask();
|
||||
task.setId(IdUtils.simpleUUID());
|
||||
task.setScenarioId(scenarioTask.getScenarioId());
|
||||
task.setResourceId(supplierResource.getId());
|
||||
task.setTaskType("1");
|
||||
|
||||
task.setFromLat(supplierResource.getLat());
|
||||
task.setFromLng(supplierResource.getLng());
|
||||
task.setToLat(fuelResource.getLat());
|
||||
task.setToLng(fuelResource.getLng());
|
||||
task.setStartTime(LocalDateTime.now());
|
||||
task.setFromSource("general");
|
||||
log.info("承担保障任务的resourceId::{}", supplierResource.getId());
|
||||
SpringUtil.getBean(ScenarioTaskServiceImpl.class).save(task);
|
||||
MoveTask moveTask = new MoveTask(task, this.roomId, new TaskAction() {
|
||||
@Override
|
||||
public void doSomeThing() {
|
||||
//创建一个保障任务
|
||||
|
||||
ScenarioTask task = new ScenarioTask();
|
||||
task.setId(IdUtils.simpleUUID());
|
||||
task.setScenarioId(scenarioTask.getScenarioId());
|
||||
task.setResourceId(supplierResource.getId());
|
||||
task.setTaskType("3");
|
||||
task.setInsureResourceId(scenarioTask.getResourceId());
|
||||
task.setSupplierNum(injured);
|
||||
task.setToLat(coordinate.getLat() + "");
|
||||
task.setToLng(coordinate.getLng() + "");
|
||||
task.setStartTime(LocalDateTime.now());
|
||||
task.setFromLat(fuelResource.getLat());
|
||||
task.setFromLng(fuelResource.getLng());
|
||||
task.setFromSource("general");
|
||||
SpringUtil.getBean(ScenarioTaskServiceImpl.class).save(task);
|
||||
SupplierTask supplierTask = new SupplierTask(task, roomId);
|
||||
RoomManager.addAction(roomId, 0, supplierTask);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return "";
|
||||
}
|
||||
});
|
||||
//立即执行
|
||||
RoomManager.addAction(roomId, 0, moveTask);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.hivekion.statistic.bean;
|
|||
import com.hivekion.baseData.entity.Fightpowerstaff;
|
||||
import com.hivekion.baseData.entity.OrgSupplier;
|
||||
import com.hivekion.scenario.entity.ScenarioOrgPost;
|
||||
import com.hivekion.scenario.entity.ScenarioResource;
|
||||
import com.hivekion.scenario.entity.ScenarioTask;
|
||||
import com.hivekion.supplier.entity.SupplierRequest;
|
||||
import lombok.Data;
|
||||
|
|
@ -38,4 +39,6 @@ public class ScenarioInfo implements Serializable {
|
|||
//药材
|
||||
private MedicalInfo medical = new MedicalInfo();
|
||||
|
||||
private ScenarioResource sdzy;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,6 +71,12 @@ public class ScenarioServiceImpl implements ScenarioService {
|
|||
@Override
|
||||
public ScenarioInfo listScenarioInfo(Integer scenarioId, String roomId, String resourceId) {
|
||||
ScenarioInfo scenarioInfo = new ScenarioInfo();
|
||||
//图标Map
|
||||
Map<String, String> iconMap = iconService.iconMap();
|
||||
//装备Map
|
||||
Map<Integer, TblEntity> entityMap = iTblEntityService.entityMap();
|
||||
Map<Integer,com.hivekion.scenario.entity.Resource> hResourceMap = resourcesService.listBuildResourceByType(7);
|
||||
Map<Integer,com.hivekion.scenario.entity.Resource> wResourceMap = resourcesService.listBuildResourceByType(8);
|
||||
//获取分队信息
|
||||
Map<Integer, Teaminfo> map = teamInfoService.teamInfoMap();
|
||||
Map<String, ScenarioResource> resourceMap = resourceService.resourceMap();
|
||||
|
|
@ -90,6 +96,59 @@ public class ScenarioServiceImpl implements ScenarioService {
|
|||
log.error("============={}==========================",resourceId);
|
||||
ex.printStackTrace();
|
||||
}
|
||||
switch (resourceInstance.getResourceType()) {
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
if (entityMap.get(resourceInstance.getResourceId()) != null) {
|
||||
TblEntity entity = entityMap.get(resourceInstance.getResourceId());
|
||||
resourceInstance.setTitle(entity.getEntityName());
|
||||
resourceInstance.setImgBase64(
|
||||
iconMap.get(entity.getIconId()) == null ? "" : iconMap.get(entity.getIconId()));
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
case 6:
|
||||
if (map.get(resourceInstance.getResourceId()) != null) {
|
||||
Teaminfo teaminfo = map.get(resourceInstance.getResourceId());
|
||||
resourceInstance.setTitle(teaminfo.getName());
|
||||
resourceInstance.setImgBase64(
|
||||
iconMap.get(teaminfo.getIconId()) == null ? "" : iconMap.get(teaminfo.getIconId()));
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
if(hResourceMap.get(resourceInstance.getResourceId()) != null){
|
||||
com.hivekion.scenario.entity.Resource resource1 = hResourceMap.get(resourceInstance.getResourceId());
|
||||
resourceInstance.setTitle(resource1.getResourceName());
|
||||
resourceInstance.setImgBase64(
|
||||
iconMap.get(resource1.getIcon()) == null ? "" : iconMap.get(resource1.getIcon()));
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
if(wResourceMap.get(resourceInstance.getResourceId()) != null){
|
||||
com.hivekion.scenario.entity.Resource resource1 = wResourceMap.get(resourceInstance.getResourceId());
|
||||
resourceInstance.setTitle(resource1.getResourceName());
|
||||
resourceInstance.setImgBase64(
|
||||
iconMap.get(resource1.getIcon()) == null ? "" : iconMap.get(resource1.getIcon()));
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (resourceMap.get(resourceId) != null) {
|
||||
ScenarioResource resource = resourceMap.get(resourceId);
|
||||
if (map.get(resource.getResourceId()) != null) {
|
||||
scenarioInfo.getTeam().setTeamName(map.get(resource.getResourceId()).getName());
|
||||
resourceInstance.setResourceName(map.get(resource.getResourceId()).getName());
|
||||
}
|
||||
}
|
||||
try {
|
||||
scenarioInfo.getTeam().setType(resourceInstance.getType());
|
||||
scenarioInfo.getTeam().setLat(resourceInstance.getLat());
|
||||
scenarioInfo.getTeam().setLng(resourceInstance.getLng());
|
||||
}catch (Exception ex){
|
||||
log.error("============={}==========================",resourceId);
|
||||
ex.printStackTrace();
|
||||
}
|
||||
//获取关联的组织机构信息
|
||||
ScenarioOrgPost post = new ScenarioOrgPost();
|
||||
post.setResourceId(resourceId);
|
||||
|
|
@ -173,6 +232,7 @@ public class ScenarioServiceImpl implements ScenarioService {
|
|||
scenarioInfo.setOrgPostList(orgPostList);
|
||||
scenarioInfo.setSuppliers(suppliers);
|
||||
scenarioInfo.setSupplierRequests(supplierRequests);
|
||||
scenarioInfo.setSdzy(resourceInstance);
|
||||
return scenarioInfo;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ public class HandleSendRunable implements Runnable {
|
|||
try {
|
||||
|
||||
ResponseCmdInfo<?> response = Global.sendCmdInfoQueue.take();
|
||||
|
||||
WsServer.sendMessage(response.getScenarioId(), response.getRoom(), JSON.toJSONString(response));
|
||||
} catch (Exception e) {
|
||||
log.error("error::", e);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
injured.warn = 60
|
||||
injured.warn = 10
|
||||
death.warn = 56
|
||||
ammunition.warn = 3
|
||||
food.warn = 3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,38 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.hivekion.baseData.mapper.WeatherResourceMapper">
|
||||
<resultMap id="WeatherResource" type="com.hivekion.baseData.entity.WeatherResource">
|
||||
<result property="id" column="id"/>
|
||||
<result property="roomId" column="room_id"/>
|
||||
<result property="scenarioId" column="scenario_id"/>
|
||||
<result property="weatherType" column="weather_type"/>
|
||||
<result property="lastBegTime" column="last_beg_time"/>
|
||||
<result property="lastEndTime" column="last_end_time"/>
|
||||
<!-- 其他字段 -->
|
||||
</resultMap>
|
||||
|
||||
<select id="list" resultType="com.hivekion.baseData.entity.WeatherResource" parameterType="com.hivekion.baseData.entity.WeatherResource" >
|
||||
SELECT
|
||||
<!-- @rownum := @rownum + 1 AS seq,-->
|
||||
*
|
||||
FROM
|
||||
SELECT * FROM TBL_WEATHER_RESOURCE
|
||||
<!--<where>
|
||||
<if test="scenarioId != null and scenarioId !='' ">
|
||||
and scenario_id =#{scenarioId}
|
||||
</if>
|
||||
</where>-->
|
||||
order by id asc <!--) t, ( SELECT @rownum := #{start} ) r limit
|
||||
#{start},#{pageSize}-->
|
||||
</select>
|
||||
|
||||
<select id="count" resultType="java.lang.Long" parameterType="com.hivekion.baseData.entity.WeatherResource" >
|
||||
select count(id) from TBL_WEATHER_RESOURCE
|
||||
<!-- <where>
|
||||
<if test="scenarioId != null and scenarioId !='' ">
|
||||
and scenario_id =#{scenarioId}
|
||||
</if>
|
||||
</where>-->
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user