Merge branch 'main' of http://git.hivekion.com:3000/liyudong/simulation-backend
# Conflicts: # src/main/java/com/hivekion/ws/WsServer.java
This commit is contained in:
commit
f4e4aaa6fc
|
@ -1,5 +1,6 @@
|
||||||
package com.hivekion;
|
package com.hivekion;
|
||||||
|
|
||||||
|
import cn.hutool.extra.spring.EnableSpringUtil;
|
||||||
import org.mybatis.spring.annotation.MapperScan;
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -13,8 +14,9 @@ import java.time.LocalDate;
|
||||||
import java.time.LocalTime;
|
import java.time.LocalTime;
|
||||||
|
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
|
@EnableSpringUtil
|
||||||
@MapperScan({"com.hivekion.**.mapper"})
|
@MapperScan({"com.hivekion.**.mapper"})
|
||||||
@ComponentScan(basePackages = { "com.hivekion.*"})
|
@ComponentScan(basePackages = {"cn.hutool.extra.spring","com.hivekion.*"})
|
||||||
public class DemoApplication extends SpringBootServletInitializer {
|
public class DemoApplication extends SpringBootServletInitializer {
|
||||||
|
|
||||||
private static Logger log = LoggerFactory.getLogger(DemoApplication.class);
|
private static Logger log = LoggerFactory.getLogger(DemoApplication.class);
|
||||||
|
|
|
@ -3,11 +3,8 @@ package com.hivekion.room.bean;
|
||||||
import com.hivekion.room.RoomManager;
|
import com.hivekion.room.RoomManager;
|
||||||
import com.hivekion.room.func.TaskAction;
|
import com.hivekion.room.func.TaskAction;
|
||||||
import com.hivekion.scenario.entity.ScenarioTask;
|
import com.hivekion.scenario.entity.ScenarioTask;
|
||||||
import java.util.concurrent.LinkedBlockingQueue;
|
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.*;
|
||||||
import java.util.concurrent.ThreadFactory;
|
|
||||||
import java.util.concurrent.ThreadPoolExecutor;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
import org.springframework.web.reactive.function.client.WebClient;
|
import org.springframework.web.reactive.function.client.WebClient;
|
||||||
|
|
||||||
|
@ -75,6 +72,22 @@ public abstract class AbtParentTask implements TaskAction {
|
||||||
public boolean getRoomStatus() {
|
public boolean getRoomStatus() {
|
||||||
return RoomManager.isRunning(roomId);
|
return RoomManager.isRunning(roomId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void createBattleTaskOnTimingHandle(BizTaskOnTiming bizTaskOnTiming){
|
||||||
|
ScheduledExecutorService schedule = Executors.newScheduledThreadPool(
|
||||||
|
1);
|
||||||
|
schedule.scheduleWithFixedDelay(() -> {
|
||||||
|
bizTaskOnTiming.execTask();
|
||||||
|
}, 0, 10, TimeUnit.SECONDS);
|
||||||
|
//房间统一管理定时器;房间关闭后,定时器销毁
|
||||||
|
addScheduledExecutorServiceRefenceToRoom(schedule);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
interface BizTaskOnTiming{
|
||||||
|
|
||||||
|
public void execTask();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 自定义线程工厂
|
// 自定义线程工厂
|
||||||
|
|
|
@ -1,15 +1,25 @@
|
||||||
package com.hivekion.room.bean;
|
package com.hivekion.room.bean;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.extra.spring.SpringUtil;
|
import cn.hutool.extra.spring.SpringUtil;
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.hivekion.Global;
|
import com.hivekion.Global;
|
||||||
import com.hivekion.common.entity.ResponseCmdInfo;
|
import com.hivekion.common.entity.ResponseCmdInfo;
|
||||||
import com.hivekion.common.redis.RedisUtil;
|
import com.hivekion.common.redis.RedisUtil;
|
||||||
|
import com.hivekion.common.uuid.IdUtils;
|
||||||
import com.hivekion.scenario.entity.ScenarioTask;
|
import com.hivekion.scenario.entity.ScenarioTask;
|
||||||
import com.hivekion.statistic.bean.*;
|
import com.hivekion.statistic.bean.*;
|
||||||
import com.hivekion.statistic.service.StatisticService;
|
import com.hivekion.statistic.service.StatisticService;
|
||||||
import com.hivekion.statistic.service.impl.StatisticServiceImpl;
|
import com.hivekion.statistic.service.impl.StatisticServiceImpl;
|
||||||
|
import com.hivekion.supplier.entity.SupplierRequest;
|
||||||
|
import com.hivekion.supplier.service.ISupplierRequestService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.core.env.Environment;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.ZoneId;
|
||||||
|
import java.util.*;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
@ -23,13 +33,16 @@ import java.util.concurrent.TimeUnit;
|
||||||
* @author LiDongYU
|
* @author LiDongYU
|
||||||
* @since 2025/7/22
|
* @since 2025/7/22
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
public class BattleRootTask extends AbtParentTask {
|
public class BattleRootTask extends AbtParentTask {
|
||||||
|
|
||||||
private StatisticService statisticService = null;
|
private StatisticService statisticService = null;
|
||||||
private RedisUtil redisUtil = null;
|
private RedisUtil redisUtil = null;
|
||||||
|
|
||||||
|
private ISupplierRequestService supplierRequestService;
|
||||||
|
|
||||||
private static final Double TEAM_SPREED = 1.2D;
|
private static final Double TEAM_SPREED = 1.2D;
|
||||||
private static final Integer PERSON_SPREED = 3;
|
private static final Double PERSON_SPREED = 3D;
|
||||||
private static final Double AMMUNITION_SPREED = 2.6D;
|
private static final Double AMMUNITION_SPREED = 2.6D;
|
||||||
private static final Double FOOD_SPREED = 2.3D;
|
private static final Double FOOD_SPREED = 2.3D;
|
||||||
private static final Double WATER_SPREED = 3.6D;
|
private static final Double WATER_SPREED = 3.6D;
|
||||||
|
@ -44,66 +57,158 @@ public class BattleRootTask extends AbtParentTask {
|
||||||
|
|
||||||
private void initBean(){
|
private void initBean(){
|
||||||
if(statisticService == null) {
|
if(statisticService == null) {
|
||||||
statisticService = SpringUtil.getBean("statisticService");
|
statisticService = SpringUtil.getBean(StatisticService.class);
|
||||||
}
|
}
|
||||||
if(redisUtil == null) {
|
if(redisUtil == null) {
|
||||||
redisUtil = SpringUtil.getBean("redisUtil");
|
redisUtil = SpringUtil.getBean(RedisUtil.class);
|
||||||
|
}
|
||||||
|
if(supplierRequestService == null){
|
||||||
|
supplierRequestService = SpringUtil.getBean(ISupplierRequestService.class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//执行一次
|
//执行一次
|
||||||
@Override
|
@Override
|
||||||
public void doSomeThing() {
|
public void doSomeThing() {
|
||||||
|
log.info("===============begin BattleRootTask=========={}==========",this.getRoomStatus());
|
||||||
this.initBean();
|
this.initBean();
|
||||||
if(this.getRoomStatus()) {
|
if(this.getRoomStatus()) {
|
||||||
long initduringTime = this.getDuringTime();
|
long initDuringTime = this.getDuringTime();
|
||||||
StatisticBean statisticBean = statisticService.statistic(scenarioTask.getResourceId());
|
StatisticBean statisticBean = null;
|
||||||
|
try {
|
||||||
|
statisticBean = statisticService.statistic(scenarioTask.getResourceId());
|
||||||
|
}catch (Exception ex){
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
HashMap<String,Object> battleParams = new HashMap<>();
|
||||||
|
|
||||||
// statisticBean.getAmmunition().getCurrent()
|
// statisticBean.getAmmunition().getCurrent()
|
||||||
//初始化本次战斗任务各种资源数
|
//初始化本次战斗任务各种资源数
|
||||||
redisUtil.hset(scenarioTask.getScenarioId()+"-"+roomId+"-"+scenarioTask.getResourceId(),"ammunition",statisticBean.getAmmunition().getCurrent());
|
|
||||||
redisUtil.hset(scenarioTask.getScenarioId()+"-"+roomId+"-"+scenarioTask.getResourceId(),"food",statisticBean.getFood().getCurrent());
|
battleParams.put("ammunition",Double.valueOf(statisticBean.getAmmunition().getCurrent()).toString());
|
||||||
redisUtil.hset(scenarioTask.getScenarioId()+"-"+roomId+"-"+scenarioTask.getResourceId(),"fuel",statisticBean.getFuel().getCurrent());
|
battleParams.put("food",Double.valueOf(statisticBean.getFood().getCurrent()).toString());
|
||||||
redisUtil.hset(scenarioTask.getScenarioId()+"-"+roomId+"-"+scenarioTask.getResourceId(),"medical",statisticBean.getMedical().getCurrent());
|
battleParams.put("fuel",Double.valueOf(statisticBean.getFuel().getCurrent()).toString());
|
||||||
redisUtil.hset(scenarioTask.getScenarioId()+"-"+roomId+"-"+scenarioTask.getResourceId(),"water",statisticBean.getWater().getCurrent());
|
battleParams.put("medical",Double.valueOf(statisticBean.getMedical().getCurrent()).toString());
|
||||||
redisUtil.hset(scenarioTask.getScenarioId()+"-"+roomId+"-"+scenarioTask.getResourceId(),"person",statisticBean.getPerson().getCurrent());
|
battleParams.put("water",Double.valueOf(statisticBean.getWater().getCurrent()).toString());
|
||||||
redisUtil.hset(scenarioTask.getScenarioId()+"-"+roomId+"-"+scenarioTask.getResourceId(),"duringTime",initduringTime);
|
battleParams.put("person",Double.valueOf(statisticBean.getPerson().getCurrent()).toString());
|
||||||
|
battleParams.put("teamLat",statisticBean.getTeam().getLat().toString());
|
||||||
|
battleParams.put("teamLng",statisticBean.getTeam().getLng().toString());
|
||||||
|
battleParams.put("duringTime",Long.valueOf(initDuringTime).toString());
|
||||||
|
redisUtil.hset(scenarioTask.getScenarioId() + "-" + roomId + "-" + scenarioTask.getResourceId(),battleParams);
|
||||||
|
log.info("===============================初始化本次战斗任务各种资源数====================================");
|
||||||
|
double suppleAmount =statisticBean.getAmmunition().getTotal();
|
||||||
|
double supplePerson =statisticBean.getPerson().getTotal();
|
||||||
|
final Map<String,Boolean> suppleFlagMap = new HashMap<>();
|
||||||
|
suppleFlagMap.put("ammunition",false);
|
||||||
|
suppleFlagMap.put("person",false);
|
||||||
//定时检查统计各种资源消耗量
|
//定时检查统计各种资源消耗量
|
||||||
ScheduledExecutorService schedule = Executors.newScheduledThreadPool(
|
this.createBattleTaskOnTimingHandle(new BizTaskOnTiming() {
|
||||||
1);
|
@Override
|
||||||
schedule.scheduleWithFixedDelay(() -> {
|
public void execTask() {
|
||||||
long duringTime = getDuringTime();
|
log.info("===============================定时检查统计各种资源消耗量 begin====================================");
|
||||||
long lastDuringTime = (long) redisUtil.hget(scenarioTask.getScenarioId()+"-"+roomId+"-"+scenarioTask.getResourceId(),"duringTime");
|
|
||||||
long intervalDuringTime = duringTime - lastDuringTime;
|
|
||||||
double ammunition = (double) redisUtil.hget(scenarioTask.getScenarioId()+"-"+roomId+"-"+scenarioTask.getResourceId(),"ammunition");
|
|
||||||
double food = (double) redisUtil.hget(scenarioTask.getScenarioId()+"-"+roomId+"-"+scenarioTask.getResourceId(),"food");
|
|
||||||
double fuel = (double) redisUtil.hget(scenarioTask.getScenarioId()+"-"+roomId+"-"+scenarioTask.getResourceId(),"fuel");
|
|
||||||
double medical = (double) redisUtil.hget(scenarioTask.getScenarioId()+"-"+roomId+"-"+scenarioTask.getResourceId(),"medical");
|
|
||||||
double water = (double) redisUtil.hget(scenarioTask.getScenarioId()+"-"+roomId+"-"+scenarioTask.getResourceId(),"water");
|
|
||||||
int person = (int) redisUtil.hget(scenarioTask.getScenarioId()+"-"+roomId+"-"+scenarioTask.getResourceId(),"person");
|
|
||||||
|
|
||||||
//
|
Double personConsume = null;
|
||||||
double teamConsume = intervalDuringTime * TEAM_SPREED;
|
Double ammunitionConsume = null;
|
||||||
long personConsume = intervalDuringTime* PERSON_SPREED ;
|
Double foodConsume = null;
|
||||||
Double ammunitionConsume = intervalDuringTime * AMMUNITION_SPREED;
|
Double waterConsume = null;
|
||||||
Double foodConsume = intervalDuringTime * FOOD_SPREED;
|
Double fuelConsume = null;
|
||||||
Double waterConsume = intervalDuringTime * WATER_SPREED;
|
Double medicalConsume = null;
|
||||||
Double fuelConsume = intervalDuringTime * FUEL_SPREED;
|
String teamLat = null;
|
||||||
Double medicalConsume = intervalDuringTime * MEDICAL_SPREED;
|
String teamLng = null;
|
||||||
|
JSONObject jsonObject = new JSONObject();
|
||||||
|
try {
|
||||||
|
HashMap<String,Object> battleParams = (HashMap<String, Object>) redisUtil.hget(scenarioTask.getScenarioId() + "-" + roomId + "-" + scenarioTask.getResourceId());
|
||||||
|
long duringTime = getDuringTime();
|
||||||
|
long lastDuringTime = Long.valueOf(battleParams.get("duringTime").toString());
|
||||||
|
long intervalDuringTime = duringTime - lastDuringTime;
|
||||||
|
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());
|
||||||
|
double person = Double.valueOf(battleParams.get("person").toString());
|
||||||
|
teamLat = battleParams.get( "teamLat").toString();
|
||||||
|
teamLng = battleParams.get( "teamLng").toString();
|
||||||
|
//
|
||||||
|
personConsume = intervalDuringTime * PERSON_SPREED;
|
||||||
|
ammunitionConsume = intervalDuringTime * AMMUNITION_SPREED;
|
||||||
|
foodConsume = intervalDuringTime * FOOD_SPREED;
|
||||||
|
waterConsume = intervalDuringTime * WATER_SPREED;
|
||||||
|
fuelConsume = intervalDuringTime * FUEL_SPREED;
|
||||||
|
medicalConsume = intervalDuringTime * MEDICAL_SPREED;
|
||||||
|
|
||||||
redisUtil.hset(scenarioTask.getScenarioId()+"-"+roomId+"-"+scenarioTask.getResourceId(),"ammunition",ammunition-ammunitionConsume);
|
battleParams.put("ammunition",Double.valueOf(ammunition - ammunitionConsume).toString());
|
||||||
redisUtil.hset(scenarioTask.getScenarioId()+"-"+roomId+"-"+scenarioTask.getResourceId(),"food",food-foodConsume);
|
battleParams.put("food",Double.valueOf(food - foodConsume).toString());
|
||||||
redisUtil.hset(scenarioTask.getScenarioId()+"-"+roomId+"-"+scenarioTask.getResourceId(),"fuel",fuel-foodConsume);
|
battleParams.put("fuel",Double.valueOf(fuel - fuelConsume).toString());
|
||||||
redisUtil.hset(scenarioTask.getScenarioId()+"-"+roomId+"-"+scenarioTask.getResourceId(),"medical",medical-medicalConsume);
|
battleParams.put("medical",Double.valueOf(medical - medicalConsume).toString());
|
||||||
redisUtil.hset(scenarioTask.getScenarioId()+"-"+roomId+"-"+scenarioTask.getResourceId(),"water",water-waterConsume);
|
battleParams.put("water",Double.valueOf(water - waterConsume).toString());
|
||||||
redisUtil.hset(scenarioTask.getScenarioId()+"-"+roomId+"-"+scenarioTask.getResourceId(),"person",person-personConsume);
|
battleParams.put("person",Double.valueOf(person - personConsume).toString());
|
||||||
redisUtil.hset(scenarioTask.getScenarioId()+"-"+roomId+"-"+scenarioTask.getResourceId(),"duringTime",duringTime);
|
battleParams.put("duringTime",Long.valueOf(duringTime).toString());
|
||||||
ResponseCmdInfo<JSONObject> sendConsumeMsg = new ResponseCmdInfo<>();
|
redisUtil.hset(scenarioTask.getScenarioId() + "-" + roomId + "-" + scenarioTask.getResourceId(), battleParams);
|
||||||
//推送消耗數據
|
}catch (Exception ex){
|
||||||
Global.sendCmdInfoQueue.add(sendConsumeMsg);
|
log.error("==============================设置消耗信息失败=============================================",ex.getMessage());
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
//推送消耗數據
|
||||||
|
ResponseCmdInfo<JSONObject> sendConsumeMsg = new ResponseCmdInfo<>();
|
||||||
|
jsonObject.put("personConsume", personConsume);
|
||||||
|
jsonObject.put("ammunitionConsume", ammunitionConsume);
|
||||||
|
jsonObject.put("foodConsume", foodConsume);
|
||||||
|
jsonObject.put("waterConsume", waterConsume);
|
||||||
|
jsonObject.put("fuelConsume", fuelConsume);
|
||||||
|
jsonObject.put("medicalConsume", medicalConsume);
|
||||||
|
jsonObject.put("teamLat",teamLat);
|
||||||
|
jsonObject.put("teamLng",teamLng);
|
||||||
|
sendConsumeMsg.setData(jsonObject);
|
||||||
|
Global.sendCmdInfoQueue.add(sendConsumeMsg);
|
||||||
|
}catch (Exception ex){
|
||||||
|
log.error("==================推送消耗數據 失败============================================",ex.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
LocalDateTime currentDateTime = new Date().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
|
||||||
|
String person = SpringUtil.getBean(Environment.class).getProperty("battle.person.warn");
|
||||||
|
String ammunition = SpringUtil.getBean(Environment.class).getProperty("battle.ammunition.warn");
|
||||||
|
log.info("===========person ammunition======={}====={}========",person,ammunition);
|
||||||
|
// String food = SpringUtil.getBean(Environment.class).getProperty("battle.food.warn");
|
||||||
|
// String water = SpringUtil.getBean(Environment.class).getProperty("battle.water.warn");
|
||||||
|
// String fuel = SpringUtil.getBean(Environment.class).getProperty("battle.fuel.warn");
|
||||||
|
// String medical = SpringUtil.getBean(Environment.class).getProperty("battle.medical.warn");
|
||||||
|
|
||||||
|
if(Double.valueOf(battleParams.get("ammunition").toString()) <= Double.valueOf(ammunition) && suppleFlagMap.get("ammunition") == false){
|
||||||
|
|
||||||
|
SupplierRequest supplierRequest = new SupplierRequest();
|
||||||
|
supplierRequest.setId(IdUtils.simpleUUID());
|
||||||
|
supplierRequest.setFromResourceId(scenarioTask.getResourceId());
|
||||||
|
supplierRequest.setSupplierNum(suppleAmount);
|
||||||
|
supplierRequest.setSupplierType("ammunition");
|
||||||
|
supplierRequest.setGeneralTime(currentDateTime);
|
||||||
|
supplierRequest.setLat(jsonObject.get("teamLat").toString());
|
||||||
|
supplierRequest.setLng(jsonObject.get("teamLng").toString());
|
||||||
|
supplierRequestService.save(supplierRequest);
|
||||||
|
suppleFlagMap.put("ammunition",true) ;
|
||||||
|
}
|
||||||
|
if(Double.valueOf(battleParams.get("person").toString()) <= Double.valueOf(person) && suppleFlagMap.get("person") == false){
|
||||||
|
SupplierRequest supplierRequest = new SupplierRequest();
|
||||||
|
supplierRequest.setId(IdUtils.simpleUUID());
|
||||||
|
supplierRequest.setFromResourceId(scenarioTask.getResourceId());
|
||||||
|
supplierRequest.setSupplierNum(supplePerson);
|
||||||
|
supplierRequest.setSupplierType("person");
|
||||||
|
supplierRequest.setGeneralTime(currentDateTime);
|
||||||
|
supplierRequest.setLat(jsonObject.get("teamLat").toString());
|
||||||
|
supplierRequest.setLng(jsonObject.get("teamLng").toString());
|
||||||
|
supplierRequestService.save(supplierRequest);
|
||||||
|
suppleFlagMap.put("person",true) ;
|
||||||
|
}
|
||||||
|
}catch (Exception ex){
|
||||||
|
ex.printStackTrace();
|
||||||
|
log.error("===========BattleRootTask supplierRequestService.saveBatch error====================",ex.getMessage());
|
||||||
|
}
|
||||||
|
log.info("===============================定时检查统计各种资源消耗量 end====================================");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}, 0, 10, TimeUnit.SECONDS);
|
|
||||||
|
|
||||||
//房间统一管理定时器;房间关闭后,定时器销毁
|
|
||||||
addScheduledExecutorServiceRefenceToRoom(schedule);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.hivekion.statistic.service.impl;
|
package com.hivekion.statistic.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import com.hivekion.baseData.entity.Fightpowerstaff;
|
import com.hivekion.baseData.entity.Fightpowerstaff;
|
||||||
import com.hivekion.baseData.entity.OrgSupplier;
|
import com.hivekion.baseData.entity.OrgSupplier;
|
||||||
import com.hivekion.baseData.service.FightpowerstaffService;
|
import com.hivekion.baseData.service.FightpowerstaffService;
|
||||||
|
@ -61,6 +62,9 @@ public class StatisticServiceImpl implements StatisticService {
|
||||||
List<ScenarioOrgPost> orgPostList = scenarioOrgPostService.selectByCondition(post);
|
List<ScenarioOrgPost> orgPostList = scenarioOrgPostService.selectByCondition(post);
|
||||||
List<Integer> orgList = orgPostList.stream().map(ScenarioOrgPost::getOrgId)
|
List<Integer> orgList = orgPostList.stream().map(ScenarioOrgPost::getOrgId)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
if(CollectionUtil.isEmpty(orgList)){
|
||||||
|
return new StatisticBean();
|
||||||
|
}
|
||||||
//获取人员信息
|
//获取人员信息
|
||||||
if(!orgList.isEmpty()){
|
if(!orgList.isEmpty()){
|
||||||
List<Fightpowerstaff> staffList = fightpowerstaffService.queryByOrgIds(orgList);
|
List<Fightpowerstaff> staffList = fightpowerstaffService.queryByOrgIds(orgList);
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.hivekion.supplier.controller;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 前端控制器
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author liDongYu
|
||||||
|
* @since 2025-09-18
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/supplier/supplierRequest")
|
||||||
|
public class SupplierRequestController {
|
||||||
|
|
||||||
|
}
|
110
src/main/java/com/hivekion/supplier/entity/SupplierRequest.java
Normal file
110
src/main/java/com/hivekion/supplier/entity/SupplierRequest.java
Normal file
|
@ -0,0 +1,110 @@
|
||||||
|
package com.hivekion.supplier.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
*
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author liDongYu
|
||||||
|
* @since 2025-09-18
|
||||||
|
*/
|
||||||
|
@TableName("TBL_SUPPLIER_REQUEST")
|
||||||
|
@ApiModel(value = "SupplierRequest对象", description = "")
|
||||||
|
public class SupplierRequest implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@TableField(value="ID")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@TableField(value="GENERAL_TIME")
|
||||||
|
private LocalDateTime generalTime;
|
||||||
|
|
||||||
|
@TableField(value="FROM_RESOURCE_ID")
|
||||||
|
private String fromResourceId;
|
||||||
|
|
||||||
|
@TableField(value="SUPPLIER_TYPE")
|
||||||
|
private String supplierType;
|
||||||
|
@TableField(value="SUPPLIER_NUM")
|
||||||
|
private Double supplierNum;
|
||||||
|
@TableField(value="LAT")
|
||||||
|
private String lat;
|
||||||
|
@TableField(value="LNG")
|
||||||
|
private String lng;
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LocalDateTime getGeneralTime() {
|
||||||
|
return generalTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGeneralTime(LocalDateTime generalTime) {
|
||||||
|
this.generalTime = generalTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFromResourceId() {
|
||||||
|
return fromResourceId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFromResourceId(String fromResourceId) {
|
||||||
|
this.fromResourceId = fromResourceId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSupplierType() {
|
||||||
|
return supplierType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSupplierType(String supplierType) {
|
||||||
|
this.supplierType = supplierType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Double getSupplierNum() {
|
||||||
|
return supplierNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSupplierNum(Double supplierNum) {
|
||||||
|
this.supplierNum = supplierNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLat() {
|
||||||
|
return lat;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLat(String lat) {
|
||||||
|
this.lat = lat;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLng() {
|
||||||
|
return lng;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLng(String lng) {
|
||||||
|
this.lng = lng;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "SupplierRequest{" +
|
||||||
|
"id = " + id +
|
||||||
|
", generalTime = " + generalTime +
|
||||||
|
", fromResourceId = " + fromResourceId +
|
||||||
|
", supplierType = " + supplierType +
|
||||||
|
", supplierNum = " + supplierNum +
|
||||||
|
", lat = " + lat +
|
||||||
|
", lng = " + lng +
|
||||||
|
"}";
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.hivekion.supplier.mapper;
|
||||||
|
|
||||||
|
import com.hivekion.supplier.entity.SupplierRequest;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author liDongYu
|
||||||
|
* @since 2025-09-18
|
||||||
|
*/
|
||||||
|
public interface SupplierRequestMapper extends BaseMapper<SupplierRequest> {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.hivekion.supplier.service;
|
||||||
|
|
||||||
|
import com.hivekion.supplier.entity.SupplierRequest;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author liDongYu
|
||||||
|
* @since 2025-09-18
|
||||||
|
*/
|
||||||
|
public interface ISupplierRequestService extends IService<SupplierRequest> {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package com.hivekion.supplier.service.impl;
|
||||||
|
|
||||||
|
import com.hivekion.supplier.entity.SupplierRequest;
|
||||||
|
import com.hivekion.supplier.mapper.SupplierRequestMapper;
|
||||||
|
import com.hivekion.supplier.service.ISupplierRequestService;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author liDongYu
|
||||||
|
* @since 2025-09-18
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class SupplierRequestServiceImpl extends ServiceImpl<SupplierRequestMapper, SupplierRequest> implements ISupplierRequestService {
|
||||||
|
|
||||||
|
}
|
|
@ -32,7 +32,7 @@ public class WsServer {
|
||||||
// key -> 当前key下所有会话
|
// key -> 当前key下所有会话
|
||||||
private static final Map<String, Map<String, Map<String, Session>>> SESSION_MAP = new ConcurrentHashMap<>();
|
private static final Map<String, Map<String, Map<String, Session>>> SESSION_MAP = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
private final Object lock = new Object();
|
private static final Object lock = new Object();
|
||||||
|
|
||||||
|
|
||||||
@OnOpen
|
@OnOpen
|
||||||
|
@ -111,11 +111,11 @@ public class WsServer {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void sendMessage(Integer scenarioId, String room, String message) {
|
public static void sendMessage(Integer scenarioId, String room, String message) {
|
||||||
|
// log.info("send {},{},{}", message, scenarioId, room);
|
||||||
|
|
||||||
Object lock = lockMap.computeIfAbsent(scenarioId, k -> new Object());
|
|
||||||
synchronized (lock) {
|
synchronized (lock) {
|
||||||
Map<String, Map<String, Session>> roomMap = SESSION_MAP.get(String.valueOf(scenarioId));
|
Map<String, Map<String, Session>> roomMap = SESSION_MAP.get(String.valueOf(scenarioId));
|
||||||
|
// log.info("roomMap:{}", roomMap);
|
||||||
if (roomMap != null) {
|
if (roomMap != null) {
|
||||||
if (roomMap.containsKey(room)) {
|
if (roomMap.containsKey(room)) {
|
||||||
Map<String, Session> singleRoomMap = roomMap.get(room);
|
Map<String, Session> singleRoomMap = roomMap.get(room);
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
battle.person.warn = 2
|
||||||
|
battle.ammunition.warn = 3
|
||||||
|
battle.food.warn = 3
|
||||||
|
battle.water.warn = 3
|
||||||
|
battle.fuel.warn = 2
|
||||||
|
battle.medical.warn = 1
|
|
@ -1,2 +1,2 @@
|
||||||
spring.profiles.active=prod
|
spring.profiles.active=prod,rule
|
||||||
#spring.profiles.active=dev
|
#spring.profiles.active=dev
|
Loading…
Reference in New Issue
Block a user