Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
3a22f7fa7d
|
|
@ -28,12 +28,12 @@ public class CodeGenerator {
|
||||||
})
|
})
|
||||||
.packageConfig(builder -> {
|
.packageConfig(builder -> {
|
||||||
builder.parent("com.hivekion") // 设置父包名
|
builder.parent("com.hivekion") // 设置父包名
|
||||||
.moduleName("basedata") // 设置模块名(可选)
|
.moduleName("supplier") // 设置模块名(可选)
|
||||||
.pathInfo(Collections.singletonMap(OutputFile.xml,
|
.pathInfo(Collections.singletonMap(OutputFile.xml,
|
||||||
basePath + "/src/main/resources/mapper/tbl")); // 设置mapperXml生成路径
|
basePath + "/src/main/resources/mapper/tbl")); // 设置mapperXml生成路径
|
||||||
})
|
})
|
||||||
.strategyConfig(builder -> {
|
.strategyConfig(builder -> {
|
||||||
builder.addInclude("IMG_VEHICLE_IMAGE".toLowerCase()) // 设置需要生成的表名(多个用逗号分隔)
|
builder.addInclude("TBL_BATTLE_SUPPLIER".toLowerCase()) // 设置需要生成的表名(多个用逗号分隔)
|
||||||
.addTablePrefix("tbl_"); // 设置过滤表前缀
|
.addTablePrefix("tbl_"); // 设置过滤表前缀
|
||||||
})
|
})
|
||||||
.execute();
|
.execute();
|
||||||
|
|
|
||||||
|
|
@ -1,33 +1,24 @@
|
||||||
package com.hivekion.room.bean;
|
package com.hivekion.room.bean;
|
||||||
|
|
||||||
import cn.hutool.extra.spring.SpringUtil;
|
import cn.hutool.extra.spring.SpringUtil;
|
||||||
import com.alibaba.fastjson2.JSON;
|
|
||||||
import com.alibaba.fastjson2.JSONArray;
|
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
|
||||||
import com.hivekion.Global;
|
|
||||||
import com.hivekion.baseData.entity.Scenario;
|
|
||||||
import com.hivekion.baseData.service.ScenarioService;
|
|
||||||
import com.hivekion.common.MultiPointGeoPosition;
|
|
||||||
import com.hivekion.common.entity.ResponseCmdInfo;
|
|
||||||
import com.hivekion.common.redis.RedisUtil;
|
import com.hivekion.common.redis.RedisUtil;
|
||||||
import com.hivekion.enums.WsCmdTypeEnum;
|
import com.hivekion.common.uuid.IdUtils;
|
||||||
|
import com.hivekion.room.RoomManager;
|
||||||
import com.hivekion.room.func.TaskAction;
|
import com.hivekion.room.func.TaskAction;
|
||||||
|
import com.hivekion.scenario.entity.ScenarioResource;
|
||||||
import com.hivekion.scenario.entity.ScenarioTask;
|
import com.hivekion.scenario.entity.ScenarioTask;
|
||||||
|
import com.hivekion.scenario.service.impl.BattleSupplierServiceImpl;
|
||||||
|
import com.hivekion.scenario.service.impl.ScenarioTaskServiceImpl;
|
||||||
import com.hivekion.statistic.bean.StatisticBean;
|
import com.hivekion.statistic.bean.StatisticBean;
|
||||||
import com.hivekion.statistic.service.impl.StatisticServiceImpl;
|
import com.hivekion.statistic.service.impl.StatisticServiceImpl;
|
||||||
import java.time.Duration;
|
import com.hivekion.supplier.entity.SupplierRequest;
|
||||||
import java.util.ArrayList;
|
import com.hivekion.supplier.service.impl.SupplierRequestServiceImpl;
|
||||||
import java.util.HashMap;
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
import java.util.NavigableMap;
|
|
||||||
import java.util.TreeMap;
|
|
||||||
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;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
import lombok.Data;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.core.env.Environment;
|
import org.springframework.core.env.Environment;
|
||||||
|
|
||||||
|
|
@ -47,7 +38,10 @@ public class MoveRootTask extends AbtParentTask implements TaskAction {
|
||||||
* 速度 换算为100Km/小时
|
* 速度 换算为100Km/小时
|
||||||
*/
|
*/
|
||||||
private final double SPEED = 27;
|
private final double SPEED = 27;
|
||||||
|
/**
|
||||||
|
* 需求产生标志
|
||||||
|
*/
|
||||||
|
private final AtomicBoolean requestFlag = new AtomicBoolean(false);
|
||||||
/**
|
/**
|
||||||
* 油料消耗速率
|
* 油料消耗速率
|
||||||
*/
|
*/
|
||||||
|
|
@ -75,7 +69,7 @@ public class MoveRootTask extends AbtParentTask implements TaskAction {
|
||||||
|
|
||||||
initEnv(); //初始化环境
|
initEnv(); //初始化环境
|
||||||
initPath(); //初始化路径
|
initPath(); //初始化路径
|
||||||
updatePath(SPEED,null); //更新路径
|
updatePath(SPEED, null); //更新路径
|
||||||
fuelConsumption();//油品消耗
|
fuelConsumption();//油品消耗
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -84,21 +78,17 @@ public class MoveRootTask extends AbtParentTask implements TaskAction {
|
||||||
*/
|
*/
|
||||||
private void initEnv() {
|
private void initEnv() {
|
||||||
|
|
||||||
|
|
||||||
//获取油品消耗规则
|
//获取油品消耗规则
|
||||||
String fuelConsumptionStr = SpringUtil.getBean(Environment.class)
|
String fuelConsumptionStr = SpringUtil.getBean(Environment.class)
|
||||||
.getProperty("fuel_spreed");
|
.getProperty("fuel_spreed");
|
||||||
fuelConsumption = Double.parseDouble(fuelConsumptionStr == null ? "0" : fuelConsumptionStr);
|
fuelConsumption = Double.parseDouble(fuelConsumptionStr == null ? "0" : fuelConsumptionStr);
|
||||||
fuelThreshold = Double.parseDouble(SpringUtil.getBean(Environment.class)
|
fuelThreshold = Double.parseDouble(SpringUtil.getBean(Environment.class)
|
||||||
.getProperty("fuel.warn ","0"));
|
.getProperty("fuel.warn ", "0"));
|
||||||
statisticBean = SpringUtil.getBean(StatisticServiceImpl.class)
|
statisticBean = SpringUtil.getBean(StatisticServiceImpl.class)
|
||||||
.statistic(scenarioTask.getResourceId());
|
.statistic(scenarioTask.getResourceId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void fuelConsumption() {
|
private void fuelConsumption() {
|
||||||
|
|
||||||
ScheduledExecutorService schedule = Executors.newScheduledThreadPool(
|
ScheduledExecutorService schedule = Executors.newScheduledThreadPool(
|
||||||
|
|
@ -107,28 +97,29 @@ public class MoveRootTask extends AbtParentTask implements TaskAction {
|
||||||
if (getRoomStatus()) {
|
if (getRoomStatus()) {
|
||||||
double currentUseUp = consumptionTaskInterval * SPEED / 1000 * fuelConsumption;
|
double currentUseUp = consumptionTaskInterval * SPEED / 1000 * fuelConsumption;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//更新redis中油品的消耗
|
//更新redis中油品的消耗
|
||||||
Object currentFuelObj = redis.hget(
|
Object currentFuelObj = redis.hget(
|
||||||
scenarioTask.getScenarioId() + "-" + roomId + "-" + scenarioTask.getResourceId(),
|
scenarioTask.getScenarioId() + "-" + roomId + "-" + scenarioTask.getResourceId(),
|
||||||
"fuelConsume");
|
"fuel");
|
||||||
if (currentFuelObj != null) {
|
if (currentFuelObj != null) {
|
||||||
double fuel = Double.parseDouble(currentFuelObj.toString());
|
double fuel = Double.parseDouble(currentFuelObj.toString());
|
||||||
fuel = fuel + currentUseUp;
|
fuel = fuel - currentUseUp;
|
||||||
//更新值
|
|
||||||
redis.hset(
|
|
||||||
scenarioTask.getScenarioId() + "-" + roomId + "-" + scenarioTask.getResourceId(),
|
|
||||||
"fuelConsume", fuel);
|
|
||||||
|
|
||||||
|
redis.hset(
|
||||||
|
scenarioTask.getScenarioId() + "-" + roomId + "-" + scenarioTask.getResourceId(),
|
||||||
|
"fuelConsume", fuel);
|
||||||
|
|
||||||
|
double totalFuel = statisticBean.getFuel().getTotal();
|
||||||
|
if (fuel * 100 / totalFuel < fuelThreshold && !requestFlag.get()) {
|
||||||
|
requestFlag.set(true);
|
||||||
|
//需要产生需求
|
||||||
|
produceFuelRequest();
|
||||||
|
//产生任务
|
||||||
|
produceTask();
|
||||||
|
|
||||||
double totalFuel = statisticBean.getFuel().getTotal();
|
|
||||||
if(fuel*100/totalFuel<fuelThreshold){
|
|
||||||
//产生一个需求
|
|
||||||
//insertRequest(totalFuel-fuel,getDuringTime());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// statistic();
|
//插入消耗表
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -136,87 +127,43 @@ public class MoveRootTask extends AbtParentTask implements TaskAction {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// private void statistic() {
|
private void produceFuelRequest() {
|
||||||
//
|
SupplierRequest supplierRequest = new SupplierRequest();
|
||||||
// Object positionObj = redis.hget(
|
supplierRequest.setId(IdUtils.simpleUUID());
|
||||||
// scenarioTask.getScenarioId() + "-" + roomId + "-" + scenarioTask.getResourceId(),
|
supplierRequest.setFromResourceId(scenarioTask.getResourceId());
|
||||||
// "position");
|
supplierRequest.setSupplierNum(String.valueOf(statisticBean.getFuel().getTotal()));
|
||||||
// if (positionObj != null) {
|
supplierRequest.setSupplierType("fuel");
|
||||||
// Coordinate coordinate = JSONObject.parseObject(positionObj.toString(), Coordinate.class);
|
supplierRequest.setGeneralTime(LocalDateTime.now());
|
||||||
// statisticBean.getTeam().setLat(coordinate.lat + "");
|
supplierRequest.setLat(scenarioTask.getToLat());
|
||||||
// statisticBean.getTeam().setLng(coordinate.lng + "");
|
supplierRequest.setLng(scenarioTask.getToLng());
|
||||||
//
|
supplierRequest.setHandleFlag(1);
|
||||||
// }
|
SpringUtil.getBean(SupplierRequestServiceImpl.class).save(supplierRequest);
|
||||||
// //设置人员受伤信息
|
}
|
||||||
// Object deathPerson = redis.hget(
|
|
||||||
// scenarioTask.getScenarioId() + "-" + roomId + "-" + scenarioTask.getResourceId(),
|
|
||||||
// "deathConsume");
|
|
||||||
// if (deathPerson != null) {
|
|
||||||
// statisticBean.getPerson().setDeath(Integer.parseInt(deathPerson.toString()));
|
|
||||||
// statisticBean.getPerson().setCurrent(
|
|
||||||
// statisticBean.getPerson().getTotal() - Integer.parseInt(deathPerson.toString()));
|
|
||||||
// }
|
|
||||||
// Object injuredPerson = redis.hget(
|
|
||||||
// scenarioTask.getScenarioId() + "-" + roomId + "-" + scenarioTask.getResourceId(),
|
|
||||||
// "injuredConsume");
|
|
||||||
// if (injuredPerson != null) {
|
|
||||||
// statisticBean.getPerson().setInjured(Integer.parseInt(injuredPerson.toString()));
|
|
||||||
// }
|
|
||||||
// //设置弹药信息
|
|
||||||
// Object ammunitionObj = redis.hget(
|
|
||||||
// scenarioTask.getScenarioId() + "-" + roomId + "-" + scenarioTask.getResourceId(),
|
|
||||||
// "ammunitionConsume");
|
|
||||||
// if (ammunitionObj != null) {
|
|
||||||
// statisticBean.getAmmunition().setCurrent(
|
|
||||||
// statisticBean.getAmmunition().getTotal() - Integer.parseInt(ammunitionObj.toString()));
|
|
||||||
// }
|
|
||||||
// //设置食品信息
|
|
||||||
// Object foodObj = redis.hget(
|
|
||||||
// scenarioTask.getScenarioId() + "-" + roomId + "-" + scenarioTask.getResourceId(),
|
|
||||||
// "foodConsume");
|
|
||||||
// if (foodObj != null) {
|
|
||||||
// statisticBean.getFood()
|
|
||||||
// .setCurrent(statisticBean.getFood().getTotal() - Integer.parseInt(foodObj.toString()));
|
|
||||||
// }
|
|
||||||
// //设置水信息
|
|
||||||
// Object waterObj = redis.hget(
|
|
||||||
// scenarioTask.getScenarioId() + "-" + roomId + "-" + scenarioTask.getResourceId(),
|
|
||||||
// "waterConsume");
|
|
||||||
// if (waterObj != null) {
|
|
||||||
// statisticBean.getWater()
|
|
||||||
// .setCurrent(statisticBean.getWater().getTotal() - Integer.parseInt(waterObj.toString()));
|
|
||||||
// }
|
|
||||||
// //设置油料信息
|
|
||||||
// Object fuelObj = redis.hget(
|
|
||||||
// scenarioTask.getScenarioId() + "-" + roomId + "-" + scenarioTask.getResourceId(),
|
|
||||||
// "fuelConsume");
|
|
||||||
// if (fuelObj != null) {
|
|
||||||
// statisticBean.getFuel()
|
|
||||||
// .setCurrent(statisticBean.getFuel().getTotal() - Integer.parseInt(fuelObj.toString()));
|
|
||||||
// }
|
|
||||||
// //设置药品信息
|
|
||||||
// Object medicalObj = redis.hget(
|
|
||||||
// scenarioTask.getScenarioId() + "-" + roomId + "-" + scenarioTask.getResourceId(),
|
|
||||||
// "medicalConsume");
|
|
||||||
// if (medicalObj != null) {
|
|
||||||
// statisticBean.getMedical().setCurrent(
|
|
||||||
// statisticBean.getMedical().getTotal() - Integer.parseInt(medicalObj.toString()));
|
|
||||||
// }
|
|
||||||
// Global.sendCmdInfoQueue.add(
|
|
||||||
// ResponseCmdInfo.create(WsCmdTypeEnum.STATISTIC.getCode(), roomId,
|
|
||||||
// scenarioTask.getScenarioId(), statisticBean));
|
|
||||||
// }
|
|
||||||
//插入需求表
|
|
||||||
// private void insertRequest(double num,long second){
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// //插入消耗表
|
|
||||||
// private void insertConsumption (double num,long second) {
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
private void produceTask() {
|
||||||
|
|
||||||
|
List<ScenarioResource> resourceList = SpringUtil.getBean(BattleSupplierServiceImpl.class)
|
||||||
|
.selectSupplierResource(scenarioTask.getResourceId());
|
||||||
|
if (!resourceList.isEmpty()) {
|
||||||
|
ScenarioTask task = new ScenarioTask();
|
||||||
|
task.setId(IdUtils.simpleUUID());
|
||||||
|
task.setScenarioId(scenarioTask.getScenarioId());
|
||||||
|
task.setResourceId(scenarioTask.getResourceId());
|
||||||
|
task.setTaskType("6");
|
||||||
|
task.setSupplierNum(statisticBean.getFuel().getTotal());
|
||||||
|
task.setToLat(scenarioTask.getToLat());
|
||||||
|
task.setToLng(scenarioTask.getToLng());
|
||||||
|
task.setStartTime(LocalDateTime.now());
|
||||||
|
task.setFromLat(resourceList.get(0).getLat());
|
||||||
|
task.setFromLng(resourceList.get(0).getLng());
|
||||||
|
task.setFromSource("general");
|
||||||
|
SpringUtil.getBean(ScenarioTaskServiceImpl.class).save(task);
|
||||||
|
//增加到房间任务
|
||||||
|
SupplierTask supplierTask = new SupplierTask(task, roomId);
|
||||||
|
//立即执行
|
||||||
|
RoomManager.addAction(roomId, 0, supplierTask);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -119,9 +119,7 @@ public class Room implements AutoCloseable {
|
||||||
return duringTime.get();
|
return duringTime.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getTotalTime() {
|
|
||||||
return totalTime.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 启动定时任务
|
// 启动定时任务
|
||||||
private void startTask() {
|
private void startTask() {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,11 @@
|
||||||
package com.hivekion.room.bean;
|
package com.hivekion.room.bean;
|
||||||
|
|
||||||
|
import cn.hutool.extra.spring.SpringUtil;
|
||||||
|
import com.hivekion.common.redis.RedisUtil;
|
||||||
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 com.hivekion.statistic.bean.StatisticBean;
|
||||||
|
import com.hivekion.statistic.service.StatisticService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [类的简要说明]
|
* [类的简要说明]
|
||||||
|
|
@ -21,9 +25,87 @@ public class SupplierTask extends AbtParentTask implements TaskAction {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doSomeThing() {
|
public void doSomeThing() {
|
||||||
|
StatisticBean statistic = SpringUtil.getBean(StatisticService.class)
|
||||||
|
.statistic(scenarioTask.getResourceId());
|
||||||
|
initPath(); //初始化路径
|
||||||
|
updatePath(30, new TaskAction() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doSomeThing() {
|
||||||
|
//达到终点点后,给目标补充物资
|
||||||
|
switch (scenarioTask.getTaskType()) {
|
||||||
|
case "4":
|
||||||
|
supplierAmmunition(statistic);
|
||||||
|
break;
|
||||||
|
case "5":
|
||||||
|
supplierWater(statistic);
|
||||||
|
break;
|
||||||
|
case "6":
|
||||||
|
supplierFuel(statistic);
|
||||||
|
break;
|
||||||
|
case "7":
|
||||||
|
supplierFood(statistic);
|
||||||
|
break;
|
||||||
|
case "8":
|
||||||
|
supplierMedical(statistic);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
//推送最新状态信息
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getId() {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getType() {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void supplierMedical(StatisticBean statistic) {
|
||||||
|
|
||||||
|
SpringUtil.getBean(RedisUtil.class)
|
||||||
|
.hset(scenarioTask.getScenarioId() + "-" + roomId + "-" + scenarioTask.getResourceId(),
|
||||||
|
"medical", statistic.getMedical().getTotal());
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void supplierFuel(StatisticBean statistic) {
|
||||||
|
|
||||||
|
SpringUtil.getBean(RedisUtil.class)
|
||||||
|
.hset(scenarioTask.getScenarioId() + "-" + roomId + "-" + scenarioTask.getResourceId(),
|
||||||
|
"fuel", statistic.getFuel().getTotal());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void supplierAmmunition(StatisticBean statistic) {
|
||||||
|
|
||||||
|
SpringUtil.getBean(RedisUtil.class)
|
||||||
|
.hset(scenarioTask.getScenarioId() + "-" + roomId + "-" + scenarioTask.getResourceId(),
|
||||||
|
"ammunition", statistic.getAmmunition().getTotal());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void supplierWater(StatisticBean statistic) {
|
||||||
|
|
||||||
|
SpringUtil.getBean(RedisUtil.class)
|
||||||
|
.hset(scenarioTask.getScenarioId() + "-" + roomId + "-" + scenarioTask.getResourceId(),
|
||||||
|
"water", statistic.getWater().getTotal());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void supplierFood(StatisticBean statistic) {
|
||||||
|
|
||||||
|
SpringUtil.getBean(RedisUtil.class)
|
||||||
|
.hset(scenarioTask.getScenarioId() + "-" + roomId + "-" + scenarioTask.getResourceId(),
|
||||||
|
"food", statistic.getFood().getTotal());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -64,5 +64,6 @@ public class ScenarioTask implements Serializable {
|
||||||
private String supplierResourceId;
|
private String supplierResourceId;
|
||||||
@TableField(value = "supplier_num")
|
@TableField(value = "supplier_num")
|
||||||
private double supplierNum;
|
private double supplierNum;
|
||||||
|
@TableField(value="from_source")
|
||||||
|
private String fromSource;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@ package com.hivekion.scenario.mapper;
|
||||||
|
|
||||||
import com.hivekion.scenario.entity.BattleSupplier;
|
import com.hivekion.scenario.entity.BattleSupplier;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.hivekion.scenario.entity.ScenarioResource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
|
|
@ -12,5 +14,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
* @since 2025-09-15
|
* @since 2025-09-15
|
||||||
*/
|
*/
|
||||||
public interface BattleSupplierMapper extends BaseMapper<BattleSupplier> {
|
public interface BattleSupplierMapper extends BaseMapper<BattleSupplier> {
|
||||||
|
List<ScenarioResource> selectSupplierResource(String battleResourceId);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package com.hivekion.scenario.service;
|
||||||
|
|
||||||
import com.hivekion.scenario.entity.BattleSupplier;
|
import com.hivekion.scenario.entity.BattleSupplier;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.hivekion.scenario.entity.ScenarioResource;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
|
@ -16,4 +17,5 @@ import java.util.Set;
|
||||||
public interface IBattleSupplierService extends IService<BattleSupplier> {
|
public interface IBattleSupplierService extends IService<BattleSupplier> {
|
||||||
public Set<String> getBattleResourceBySupplierId(String id);
|
public Set<String> getBattleResourceBySupplierId(String id);
|
||||||
public Set<String> getSupplierIdByBattleId(String id);
|
public Set<String> getSupplierIdByBattleId(String id);
|
||||||
|
List<ScenarioResource> selectSupplierResource(String battleResourceId);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
package com.hivekion.scenario.service.impl;
|
package com.hivekion.scenario.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.hivekion.scenario.entity.BattleSupplier;
|
import com.hivekion.scenario.entity.BattleSupplier;
|
||||||
|
import com.hivekion.scenario.entity.ScenarioResource;
|
||||||
import com.hivekion.scenario.mapper.BattleSupplierMapper;
|
import com.hivekion.scenario.mapper.BattleSupplierMapper;
|
||||||
import com.hivekion.scenario.service.IBattleSupplierService;
|
import com.hivekion.scenario.service.IBattleSupplierService;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
@ -13,19 +13,20 @@ import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 服务实现类
|
* 服务实现类
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author liDongYu
|
* @author liDongYu
|
||||||
* @since 2025-09-15
|
* @since 2025-09-15
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class BattleSupplierServiceImpl extends ServiceImpl<BattleSupplierMapper, BattleSupplier> implements IBattleSupplierService {
|
public class BattleSupplierServiceImpl extends
|
||||||
|
ServiceImpl<BattleSupplierMapper, BattleSupplier> implements IBattleSupplierService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<String> getBattleResourceBySupplierId(String id) {
|
public Set<String> getBattleResourceBySupplierId(String id) {
|
||||||
QueryWrapper<BattleSupplier> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<BattleSupplier> queryWrapper = new QueryWrapper<>();
|
||||||
queryWrapper.eq("supplier_resource_id",id);
|
queryWrapper.eq("supplier_resource_id", id);
|
||||||
List<BattleSupplier> list = this.list(queryWrapper);
|
List<BattleSupplier> list = this.list(queryWrapper);
|
||||||
return list.stream().map(BattleSupplier::getBattleResourceId).collect(Collectors.toSet());
|
return list.stream().map(BattleSupplier::getBattleResourceId).collect(Collectors.toSet());
|
||||||
}
|
}
|
||||||
|
|
@ -33,9 +34,14 @@ public class BattleSupplierServiceImpl extends ServiceImpl<BattleSupplierMapper,
|
||||||
@Override
|
@Override
|
||||||
public Set<String> getSupplierIdByBattleId(String id) {
|
public Set<String> getSupplierIdByBattleId(String id) {
|
||||||
QueryWrapper<BattleSupplier> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<BattleSupplier> queryWrapper = new QueryWrapper<>();
|
||||||
queryWrapper.eq("battle_resource_id",id);
|
queryWrapper.eq("battle_resource_id", id);
|
||||||
List<BattleSupplier> list = this.list(queryWrapper);
|
List<BattleSupplier> list = this.list(queryWrapper);
|
||||||
|
|
||||||
return list.stream().map(BattleSupplier::getSupplierResourceId).collect(Collectors.toSet());
|
return list.stream().map(BattleSupplier::getSupplierResourceId).collect(Collectors.toSet());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ScenarioResource> selectSupplierResource(String battleResourceId) {
|
||||||
|
return this.baseMapper.selectSupplierResource(battleResourceId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,102 +2,54 @@ package com.hivekion.supplier.entity;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import io.swagger.annotations.ApiModel;
|
import lombok.Data;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
*
|
*
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author liDongYu
|
* @author liDongYu
|
||||||
* @since 2025-09-18
|
* @since 2025-09-18
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
@TableName("TBL_SUPPLIER_REQUEST")
|
@TableName("TBL_SUPPLIER_REQUEST")
|
||||||
@ApiModel(value = "SupplierRequest对象", description = "")
|
@ApiModel(value = "SupplierRequest对象", description = "")
|
||||||
public class SupplierRequest implements Serializable {
|
public class SupplierRequest implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@TableField(value="ID")
|
@TableField(value = "ID")
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
@TableField(value="GENERAL_TIME")
|
@TableField(value = "GENERAL_TIME")
|
||||||
private LocalDateTime generalTime;
|
private LocalDateTime generalTime;
|
||||||
|
|
||||||
@TableField(value="FROM_RESOURCE_ID")
|
@TableField(value = "FROM_RESOURCE_ID")
|
||||||
private String fromResourceId;
|
private String fromResourceId;
|
||||||
|
|
||||||
@TableField(value="SUPPLIER_TYPE")
|
@TableField(value = "SUPPLIER_TYPE")
|
||||||
private String supplierType;
|
private String supplierType;
|
||||||
@TableField(value="SUPPLIER_NUM")
|
@TableField(value = "SUPPLIER_NUM")
|
||||||
private String supplierNum;
|
private String supplierNum;
|
||||||
@TableField(value="LAT")
|
@TableField(value = "LAT")
|
||||||
private String lat;
|
private String lat;
|
||||||
@TableField(value="LNG")
|
@TableField(value = "LNG")
|
||||||
private String lng;
|
private String lng;
|
||||||
|
/**
|
||||||
|
* 0 未处理 ;1 处理
|
||||||
|
*/
|
||||||
|
@TableField(value = "handle_flag")
|
||||||
|
private int handleFlag;
|
||||||
|
|
||||||
public String getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(String id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public LocalDateTime getGeneralTime() {
|
@Override
|
||||||
return generalTime;
|
public String toString() {
|
||||||
}
|
return "SupplierRequest{" +
|
||||||
|
|
||||||
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 String getSupplierNum() {
|
|
||||||
return supplierNum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSupplierNum(String 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 +
|
"id = " + id +
|
||||||
", generalTime = " + generalTime +
|
", generalTime = " + generalTime +
|
||||||
", fromResourceId = " + fromResourceId +
|
", fromResourceId = " + fromResourceId +
|
||||||
|
|
@ -106,5 +58,5 @@ public class SupplierRequest implements Serializable {
|
||||||
", lat = " + lat +
|
", lat = " + lat +
|
||||||
", lng = " + lng +
|
", lng = " + lng +
|
||||||
"}";
|
"}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ import java.util.stream.Collectors;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
@ -49,6 +50,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
@Validated
|
@Validated
|
||||||
@RestController
|
@RestController
|
||||||
@Api(value = "登录管理", tags = {"认证管理-登录"})
|
@Api(value = "登录管理", tags = {"认证管理-登录"})
|
||||||
|
@Slf4j
|
||||||
public class UserLoginController {
|
public class UserLoginController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
@ -161,6 +163,7 @@ public class UserLoginController {
|
||||||
throw new BusinessException(500, "客户端编码为空");
|
throw new BusinessException(500, "客户端编码为空");
|
||||||
}
|
}
|
||||||
String capText = captchaProducer.createText();
|
String capText = captchaProducer.createText();
|
||||||
|
log.info("capText::{}",capText);
|
||||||
try {
|
try {
|
||||||
Object o = redisUtil.get(clientCode);
|
Object o = redisUtil.get(clientCode);
|
||||||
if (o != null) {
|
if (o != null) {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,11 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?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">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.hivekion.scenario.mapper.BattleSupplierMapper">
|
<mapper namespace="com.hivekion.scenario.mapper.BattleSupplierMapper">
|
||||||
|
<select id="selectSupplierResource" resultType="com.hivekion.scenario.entity.ScenarioResource">
|
||||||
|
select id ,lng,lat,scenario_Id as scenarioId, resource_name as resourceName
|
||||||
|
from tbl_scenario_resource
|
||||||
|
where resource_id in
|
||||||
|
(select supplier_resource_id from tbl_battle_supplier where battle_resoure_id = #{battleResourceId})
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user