diff --git a/src/main/java/com/hivekion/baseData/controller/ScenarioController.java b/src/main/java/com/hivekion/baseData/controller/ScenarioController.java index 7d2541d..df9ae0f 100644 --- a/src/main/java/com/hivekion/baseData/controller/ScenarioController.java +++ b/src/main/java/com/hivekion/baseData/controller/ScenarioController.java @@ -11,6 +11,7 @@ import com.hivekion.common.enums.ResultCodeEnum; import com.hivekion.common.security.SecurityUtils; import com.hivekion.common.uuid.IdUtils; import com.hivekion.icon.service.IconService; +import com.hivekion.scenario.service.IResourceService; import com.hivekion.scenario.service.ScenarioResourceService; import com.hivekion.team.entity.Teaminfo; import com.hivekion.team.service.ITeaminfoService; @@ -54,6 +55,9 @@ public class ScenarioController extends BaseController { @Resource private ScenarioResourceService scenarioResourceService; + @Resource + private IResourceService iResourceService; + /** * 查询想定列表 * @@ -172,8 +176,16 @@ public class ScenarioController extends BaseController { } /** - * 获取想定资源 type=1 飞机 对应tbl_entity表中id=1 || type=2 地面兵力于设施 对应tbl_entity 表中id=4 ||type=3 水面舰艇 id=2 - * type=4 潜艇 id=3|| type=5 作战部队 对应tbl_teaminfo中 type=0 ||type=6 保障部队 对应tbl_teaminfo 中 type=1 + * 获取想定资源 + * + * type=1 飞机 对应tbl_entity表中id=1 || + * type=2 地面兵力于设施 对应tbl_entity 表中id=4 || + * type=3 水面舰艇 id=2 + * type=4 潜艇 id=3|| + * type=5 作战部队 对应tbl_teaminfo中 type=0 || + * type=6 保障部队 对应tbl_teaminfo 中 type=1 + * type =7 医院 + * tupe=8 仓库 * * @param type 类型 * @return 资源信息 @@ -202,6 +214,12 @@ public class ScenarioController extends BaseController { case 6: return ResponseData.success( covertTeamInfoToResource(type, iTeaminfoService.queryByType(1), iconMap)); + case 7: + return ResponseData.success( + covertBuildInfoToResource(type,iResourceService.listAllBuildResourceByType(7),iconMap)); + case 8: + return ResponseData.success( + covertBuildInfoToResource(type,iResourceService.listAllBuildResourceByType(8),iconMap)); default: return ResponseData.error(ResultCodeEnum.PARAMETER_ERROR, null); @@ -236,4 +254,18 @@ public class ScenarioController extends BaseController { }); return resources; } + + private List covertBuildInfoToResource(Integer type, List list, + Map iconMap) { + List resources = new ArrayList<>(); + list.forEach(e -> { + ScenarioResource resource = new ScenarioResource(); + resource.setId(e.getId()); + resource.setType(type); + resource.setName(e.getResourceName()); + resource.setImgBase64(iconMap.get(e.getIcon())); + resources.add(resource); + }); + return resources; + } } diff --git a/src/main/java/com/hivekion/baseData/controller/WeatherResourceController.java b/src/main/java/com/hivekion/baseData/controller/WeatherResourceController.java new file mode 100644 index 0000000..390bfce --- /dev/null +++ b/src/main/java/com/hivekion/baseData/controller/WeatherResourceController.java @@ -0,0 +1,18 @@ +package com.hivekion.baseData.controller; + +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.stereotype.Controller; + +/** + *

+ * 气像资源信息 前端控制器 + *

+ * + * @author liDongYu + * @since 2025-09-14 + */ +@Controller +@RequestMapping("/baseData/weatherResource") +public class WeatherResourceController { + +} diff --git a/src/main/java/com/hivekion/baseData/entity/WeatherResource.java b/src/main/java/com/hivekion/baseData/entity/WeatherResource.java new file mode 100644 index 0000000..ccd84ae --- /dev/null +++ b/src/main/java/com/hivekion/baseData/entity/WeatherResource.java @@ -0,0 +1,103 @@ +package com.hivekion.baseData.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + *

+ * 气像资源信息 + *

+ * + * @author liDongYu + * @since 2025-09-14 + */ +@TableName("TBL_WEATHER_RESOURCE") +@ApiModel(value = "WeatherResource对象", description = "气像资源信息") +public class WeatherResource implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("物理主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty("想定房间编号") + private String roomId; + + @ApiModelProperty("想定场景编号") + private Integer scenarioId; + + @ApiModelProperty("天气类型") + private String weatherType; + + @ApiModelProperty("持续开始时间") + private LocalDateTime lastBegTime; + + @ApiModelProperty("持续结束时间") + private LocalDateTime lastEndTime; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getRoomId() { + return roomId; + } + + public void setRoomId(String roomId) { + this.roomId = roomId; + } + + public Integer getScenarioId() { + return scenarioId; + } + + public void setScenarioId(Integer scenarioId) { + this.scenarioId = scenarioId; + } + + public String getWeatherType() { + return weatherType; + } + + public void setWeatherType(String weatherType) { + this.weatherType = weatherType; + } + + public LocalDateTime getLastBegTime() { + return lastBegTime; + } + + public void setLastBegTime(LocalDateTime lastBegTime) { + this.lastBegTime = lastBegTime; + } + + public LocalDateTime getLastEndTime() { + return lastEndTime; + } + + public void setLastEndTime(LocalDateTime lastEndTime) { + this.lastEndTime = lastEndTime; + } + + @Override + public String toString() { + return "WeatherResource{" + + "id = " + id + + ", roomId = " + roomId + + ", scenarioId = " + scenarioId + + ", weatherType = " + weatherType + + ", lastBegTime = " + lastBegTime + + ", lastEndTime = " + lastEndTime + + "}"; + } +} diff --git a/src/main/java/com/hivekion/baseData/mapper/WeatherResourceMapper.java b/src/main/java/com/hivekion/baseData/mapper/WeatherResourceMapper.java new file mode 100644 index 0000000..b14b0c6 --- /dev/null +++ b/src/main/java/com/hivekion/baseData/mapper/WeatherResourceMapper.java @@ -0,0 +1,16 @@ +package com.hivekion.baseData.mapper; + +import com.hivekion.baseData.entity.WeatherResource; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 气像资源信息 Mapper 接口 + *

+ * + * @author liDongYu + * @since 2025-09-14 + */ +public interface WeatherResourceMapper extends BaseMapper { + +} diff --git a/src/main/java/com/hivekion/baseData/service/IWeatherResourceService.java b/src/main/java/com/hivekion/baseData/service/IWeatherResourceService.java new file mode 100644 index 0000000..8cfc15a --- /dev/null +++ b/src/main/java/com/hivekion/baseData/service/IWeatherResourceService.java @@ -0,0 +1,16 @@ +package com.hivekion.baseData.service; + +import com.hivekion.baseData.entity.WeatherResource; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 气像资源信息 服务类 + *

+ * + * @author liDongYu + * @since 2025-09-14 + */ +public interface IWeatherResourceService extends IService { + +} diff --git a/src/main/java/com/hivekion/baseData/service/impl/WeatherResourceServiceImpl.java b/src/main/java/com/hivekion/baseData/service/impl/WeatherResourceServiceImpl.java new file mode 100644 index 0000000..c44b5e3 --- /dev/null +++ b/src/main/java/com/hivekion/baseData/service/impl/WeatherResourceServiceImpl.java @@ -0,0 +1,20 @@ +package com.hivekion.baseData.service.impl; + +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; + +/** + *

+ * 气像资源信息 服务实现类 + *

+ * + * @author liDongYu + * @since 2025-09-14 + */ +@Service +public class WeatherResourceServiceImpl extends ServiceImpl implements IWeatherResourceService { + +} diff --git a/src/main/java/com/hivekion/scenario/controller/ResourceController.java b/src/main/java/com/hivekion/scenario/controller/ResourceController.java new file mode 100644 index 0000000..ad3646b --- /dev/null +++ b/src/main/java/com/hivekion/scenario/controller/ResourceController.java @@ -0,0 +1,18 @@ +package com.hivekion.scenario.controller; + +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.stereotype.Controller; + +/** + *

+ * 建筑资源表 前端控制器 + *

+ * + * @author wangWenHua + * @since 2025-09-14 + */ +@Controller +@RequestMapping("/scenario/resource") +public class ResourceController { + +} diff --git a/src/main/java/com/hivekion/scenario/controller/ResourceVehicleRelaController.java b/src/main/java/com/hivekion/scenario/controller/ResourceVehicleRelaController.java new file mode 100644 index 0000000..8b0b667 --- /dev/null +++ b/src/main/java/com/hivekion/scenario/controller/ResourceVehicleRelaController.java @@ -0,0 +1,18 @@ +package com.hivekion.scenario.controller; + +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.stereotype.Controller; + +/** + *

+ * 资源车辆表 前端控制器 + *

+ * + * @author wangWenHua + * @since 2025-09-13 + */ +@Controller +@RequestMapping("/scenario/resourceVehicleRela") +public class ResourceVehicleRelaController { + +} diff --git a/src/main/java/com/hivekion/scenario/controller/VehicleController.java b/src/main/java/com/hivekion/scenario/controller/VehicleController.java new file mode 100644 index 0000000..78f11d2 --- /dev/null +++ b/src/main/java/com/hivekion/scenario/controller/VehicleController.java @@ -0,0 +1,18 @@ +package com.hivekion.scenario.controller; + +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.stereotype.Controller; + +/** + *

+ * 车辆信息表 前端控制器 + *

+ * + * @author liDongYu + * @since 2025-09-13 + */ +@Controller +@RequestMapping("/scenario/vehicle") +public class VehicleController { + +} diff --git a/src/main/java/com/hivekion/scenario/entity/Resource.java b/src/main/java/com/hivekion/scenario/entity/Resource.java new file mode 100644 index 0000000..a9a8468 --- /dev/null +++ b/src/main/java/com/hivekion/scenario/entity/Resource.java @@ -0,0 +1,144 @@ +package com.hivekion.scenario.entity; + +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 java.io.Serializable; +import java.math.BigDecimal; +import java.util.Map; + +import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + *

+ * 建筑资源表 + *

+ * + * @author wangWenHua + * @since 2025-09-14 + */ +@TableName("TBL_RESOURCE") +@ApiModel(value = "Resource对象", description = "建筑资源表") +public class Resource implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("物理主键id") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty("设施名称") + private String resourceName; + + @ApiModelProperty("设施图标") + private String icon; + + @ApiModelProperty("纬度") + private String lat; + + @ApiModelProperty("经度") + private String lng; + + @ApiModelProperty("设施属性") + @TableField(typeHandler = JacksonTypeHandler.class) + private Map resourceAttribut; + + @ApiModelProperty("创建人") + private String createOper; + + @ApiModelProperty("更新人") + private String updOper; + + @ApiModelProperty("保障建筑资源类型") + private Integer resourceType; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getResourceName() { + return resourceName; + } + + public void setResourceName(String resourceName) { + this.resourceName = resourceName; + } + + public String getIcon() { + return icon; + } + + public void setIcon(String icon) { + this.icon = icon; + } + + 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; + } + + public Map getResourceAttribut() { + return resourceAttribut; + } + + public void setResourceAttribut(Map resourceAttribut) { + this.resourceAttribut = resourceAttribut; + } + + public String getCreateOper() { + return createOper; + } + + public void setCreateOper(String createOper) { + this.createOper = createOper; + } + + public String getUpdOper() { + return updOper; + } + + public void setUpdOper(String updOper) { + this.updOper = updOper; + } + + public Integer getResourceType() { + return resourceType; + } + + public void setResourceType(Integer resourceType) { + this.resourceType = resourceType; + } + + @Override + public String toString() { + return "Resource{" + + "id = " + id + + ", resourceName = " + resourceName + + ", icon = " + icon + + ", lat = " + lat + + ", lng = " + lng + + ", resourceAttribut = " + resourceAttribut + + ", createOper = " + createOper + + ", updOper = " + updOper + + ", resourceType = " + resourceType + + "}"; + } +} diff --git a/src/main/java/com/hivekion/scenario/entity/ResourceVehicleRela.java b/src/main/java/com/hivekion/scenario/entity/ResourceVehicleRela.java new file mode 100644 index 0000000..7e45cc4 --- /dev/null +++ b/src/main/java/com/hivekion/scenario/entity/ResourceVehicleRela.java @@ -0,0 +1,51 @@ +package com.hivekion.scenario.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + *

+ * 资源车辆表 + *

+ * + * @author wangWenHua + * @since 2025-09-13 + */ +@TableName("TBL_RESOURCE_VEHICLE_RELA") +@ApiModel(value = "ResourceVehicleRela对象", description = "资源车辆表") +public class ResourceVehicleRela implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("资源id") + private Integer resourceId; + + @ApiModelProperty("车辆id") + private Integer vehicleId; + + public Integer getResourceId() { + return resourceId; + } + + public void setResourceId(Integer resourceId) { + this.resourceId = resourceId; + } + + public Integer getVehicleId() { + return vehicleId; + } + + public void setVehicleId(Integer vehicleId) { + this.vehicleId = vehicleId; + } + + @Override + public String toString() { + return "ResourceVehicleRela{" + + "resourceId = " + resourceId + + ", vehicleId = " + vehicleId + + "}"; + } +} diff --git a/src/main/java/com/hivekion/scenario/entity/Vehicle.java b/src/main/java/com/hivekion/scenario/entity/Vehicle.java new file mode 100644 index 0000000..0bfcb6b --- /dev/null +++ b/src/main/java/com/hivekion/scenario/entity/Vehicle.java @@ -0,0 +1,135 @@ +package com.hivekion.scenario.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + *

+ * 车辆信息表 + *

+ * + * @author liDongYu + * @since 2025-09-13 + */ +@TableName("TBL_VEHICLE") +@ApiModel(value = "Vehicle对象", description = "车辆信息表") +public class Vehicle implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("物理主键id") + private Integer id; + + @ApiModelProperty("名称") + private String vehicleName; + + @ApiModelProperty("速度") + private String vehicleSpreed; + + @ApiModelProperty("类型") + private String vehicleType; + + @ApiModelProperty("运油能力") + private Integer fuelAbility; + + @ApiModelProperty("运药能力") + private Integer medicalAbility; + + @ApiModelProperty("运弹药能力") + private Integer ammunitionAbility; + + @ApiModelProperty("创建人") + private String createOper; + + @ApiModelProperty("更新人") + private String updOper; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getVehicleName() { + return vehicleName; + } + + public void setVehicleName(String vehicleName) { + this.vehicleName = vehicleName; + } + + public String getVehicleSpreed() { + return vehicleSpreed; + } + + public void setVehicleSpreed(String vehicleSpreed) { + this.vehicleSpreed = vehicleSpreed; + } + + public String getVehicleType() { + return vehicleType; + } + + public void setVehicleType(String vehicleType) { + this.vehicleType = vehicleType; + } + + public Integer getFuelAbility() { + return fuelAbility; + } + + public void setFuelAbility(Integer fuelAbility) { + this.fuelAbility = fuelAbility; + } + + public Integer getMedicalAbility() { + return medicalAbility; + } + + public void setMedicalAbility(Integer medicalAbility) { + this.medicalAbility = medicalAbility; + } + + public Integer getAmmunitionAbility() { + return ammunitionAbility; + } + + public void setAmmunitionAbility(Integer ammunitionAbility) { + this.ammunitionAbility = ammunitionAbility; + } + + public String getCreateOper() { + return createOper; + } + + public void setCreateOper(String createOper) { + this.createOper = createOper; + } + + public String getUpdOper() { + return updOper; + } + + public void setUpdOper(String updOper) { + this.updOper = updOper; + } + + @Override + public String toString() { + return "Vehicle{" + + "id = " + id + + ", vehicleName = " + vehicleName + + ", vehicleSpreed = " + vehicleSpreed + + ", vehicleType = " + vehicleType + + ", fuelAbility = " + fuelAbility + + ", medicalAbility = " + medicalAbility + + ", ammunitionAbility = " + ammunitionAbility + + ", createOper = " + createOper + + ", updOper = " + updOper + + "}"; + } +} diff --git a/src/main/java/com/hivekion/scenario/mapper/ResourceMapper.java b/src/main/java/com/hivekion/scenario/mapper/ResourceMapper.java new file mode 100644 index 0000000..8afedd5 --- /dev/null +++ b/src/main/java/com/hivekion/scenario/mapper/ResourceMapper.java @@ -0,0 +1,16 @@ +package com.hivekion.scenario.mapper; + +import com.hivekion.scenario.entity.Resource; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 建筑资源表 Mapper 接口 + *

+ * + * @author wangWenHua + * @since 2025-09-14 + */ +public interface ResourceMapper extends BaseMapper { + +} diff --git a/src/main/java/com/hivekion/scenario/mapper/ResourceVehicleRelaMapper.java b/src/main/java/com/hivekion/scenario/mapper/ResourceVehicleRelaMapper.java new file mode 100644 index 0000000..397dc49 --- /dev/null +++ b/src/main/java/com/hivekion/scenario/mapper/ResourceVehicleRelaMapper.java @@ -0,0 +1,16 @@ +package com.hivekion.scenario.mapper; + +import com.hivekion.scenario.entity.ResourceVehicleRela; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 资源车辆表 Mapper 接口 + *

+ * + * @author wangWenHua + * @since 2025-09-13 + */ +public interface ResourceVehicleRelaMapper extends BaseMapper { + +} diff --git a/src/main/java/com/hivekion/scenario/mapper/VehicleMapper.java b/src/main/java/com/hivekion/scenario/mapper/VehicleMapper.java new file mode 100644 index 0000000..e081334 --- /dev/null +++ b/src/main/java/com/hivekion/scenario/mapper/VehicleMapper.java @@ -0,0 +1,16 @@ +package com.hivekion.scenario.mapper; + +import com.hivekion.scenario.entity.Vehicle; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 车辆信息表 Mapper 接口 + *

+ * + * @author liDongYu + * @since 2025-09-13 + */ +public interface VehicleMapper extends BaseMapper { + +} diff --git a/src/main/java/com/hivekion/scenario/service/IResourceService.java b/src/main/java/com/hivekion/scenario/service/IResourceService.java new file mode 100644 index 0000000..ebfe574 --- /dev/null +++ b/src/main/java/com/hivekion/scenario/service/IResourceService.java @@ -0,0 +1,20 @@ +package com.hivekion.scenario.service; + +import com.hivekion.scenario.entity.Resource; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.List; + +/** + *

+ * 建筑资源表 服务类 + *

+ * + * @author wangWenHua + * @since 2025-09-14 + */ +public interface IResourceService extends IService { + + public List listAllBuildResourceByType(Integer type); + +} diff --git a/src/main/java/com/hivekion/scenario/service/IResourceVehicleRelaService.java b/src/main/java/com/hivekion/scenario/service/IResourceVehicleRelaService.java new file mode 100644 index 0000000..38092b6 --- /dev/null +++ b/src/main/java/com/hivekion/scenario/service/IResourceVehicleRelaService.java @@ -0,0 +1,16 @@ +package com.hivekion.scenario.service; + +import com.hivekion.scenario.entity.ResourceVehicleRela; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 资源车辆表 服务类 + *

+ * + * @author wangWenHua + * @since 2025-09-13 + */ +public interface IResourceVehicleRelaService extends IService { + +} diff --git a/src/main/java/com/hivekion/scenario/service/IVehicleService.java b/src/main/java/com/hivekion/scenario/service/IVehicleService.java new file mode 100644 index 0000000..cbf7e60 --- /dev/null +++ b/src/main/java/com/hivekion/scenario/service/IVehicleService.java @@ -0,0 +1,16 @@ +package com.hivekion.scenario.service; + +import com.hivekion.scenario.entity.Vehicle; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 车辆信息表 服务类 + *

+ * + * @author liDongYu + * @since 2025-09-13 + */ +public interface IVehicleService extends IService { + +} diff --git a/src/main/java/com/hivekion/scenario/service/impl/ResourceServiceImpl.java b/src/main/java/com/hivekion/scenario/service/impl/ResourceServiceImpl.java new file mode 100644 index 0000000..5940788 --- /dev/null +++ b/src/main/java/com/hivekion/scenario/service/impl/ResourceServiceImpl.java @@ -0,0 +1,29 @@ +package com.hivekion.scenario.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.hivekion.scenario.entity.Resource; +import com.hivekion.scenario.mapper.ResourceMapper; +import com.hivekion.scenario.service.IResourceService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 建筑资源表 服务实现类 + *

+ * + * @author wangWenHua + * @since 2025-09-14 + */ +@Service +public class ResourceServiceImpl extends ServiceImpl implements IResourceService { + + @Override + public List listAllBuildResourceByType(Integer type) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq(type != null,"resource_type",type); + return this.list(queryWrapper); + } +} diff --git a/src/main/java/com/hivekion/scenario/service/impl/ResourceVehicleRelaServiceImpl.java b/src/main/java/com/hivekion/scenario/service/impl/ResourceVehicleRelaServiceImpl.java new file mode 100644 index 0000000..5525f39 --- /dev/null +++ b/src/main/java/com/hivekion/scenario/service/impl/ResourceVehicleRelaServiceImpl.java @@ -0,0 +1,20 @@ +package com.hivekion.scenario.service.impl; + +import com.hivekion.scenario.entity.ResourceVehicleRela; +import com.hivekion.scenario.mapper.ResourceVehicleRelaMapper; +import com.hivekion.scenario.service.IResourceVehicleRelaService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 资源车辆表 服务实现类 + *

+ * + * @author wangWenHua + * @since 2025-09-13 + */ +@Service +public class ResourceVehicleRelaServiceImpl extends ServiceImpl implements IResourceVehicleRelaService { + +} diff --git a/src/main/java/com/hivekion/scenario/service/impl/ScenarioTaskServiceImpl.java b/src/main/java/com/hivekion/scenario/service/impl/ScenarioTaskServiceImpl.java index 9318543..5a7a71c 100644 --- a/src/main/java/com/hivekion/scenario/service/impl/ScenarioTaskServiceImpl.java +++ b/src/main/java/com/hivekion/scenario/service/impl/ScenarioTaskServiceImpl.java @@ -1,14 +1,14 @@ package com.hivekion.scenario.service.impl; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; -import com.alibaba.fastjson2.JSONArray; +import cn.hutool.json.JSONArray; +import cn.hutool.json.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.hivekion.Global; import com.hivekion.baseData.entity.Scenario; +import com.hivekion.baseData.entity.WeatherResource; +import com.hivekion.baseData.service.IWeatherResourceService; 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.environment.entity.SimtoolWeather; @@ -17,15 +17,13 @@ import com.hivekion.scenario.entity.ScenarioTask; import com.hivekion.scenario.mapper.ScenarioTaskMapper; import com.hivekion.scenario.service.ScenarioTaskService; import com.hivekion.thread.SpringGlobalTaskManager; -import java.util.ArrayList; -import java.util.HashMap; + +import java.text.SimpleDateFormat; +import java.time.format.DateTimeFormatter; import java.util.List; -import java.util.Map; import javax.annotation.Resource; import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; -import org.springframework.web.reactive.function.client.WebClient; /** *

@@ -48,10 +46,9 @@ public class ScenarioTaskServiceImpl extends private RedisUtil redisUtil; @Resource private ScenarioService scenarioService; - private final static double SPEED = 18.0; - @Value("${path.planning.url}") - private String pathPlanningUrl; - private final WebClient webClient = WebClient.create(); + + @Resource + private IWeatherResourceService weatherResourceService; @Override public void start(Integer id, String roomId) { @@ -102,7 +99,7 @@ public class ScenarioTaskServiceImpl extends private void increaseTime(Scenario currentScenario, String roomId) { int mag = Global.roomParamMap.get(currentScenario.getId() + "_" + roomId) == null ? 1 - : Global.roomParamMap.get(currentScenario.getId() + "_" + roomId).getMag(); + : Global.roomParamMap.get(currentScenario.getId() + "_" + roomId).getAmg(); //获取当前状态 Object statusObj = redisUtil.hget(roomId + "_" + currentScenario.getId(), "status"); if (statusObj != null && statusObj.toString().equals("running")) { @@ -123,85 +120,35 @@ public class ScenarioTaskServiceImpl extends * @param roomId 房间ID */ private void weatherTrigger(Scenario currentScenario, String roomId) { + try { + QueryWrapper weatherResourceQueryWrapper = new QueryWrapper<>(); + weatherResourceQueryWrapper.eq("scenario_id", currentScenario.getId()).eq("room_id", roomId); + List weatherResourceList = this.weatherResourceService.list(); + ResponseCmdInfo responseCmdInfo = new ResponseCmdInfo(); + responseCmdInfo.setScenarioId(currentScenario.getId()); + responseCmdInfo.setRoom(roomId); + JSONArray weatherMsgArray = new JSONArray(); + for(WeatherResource weatherResource: weatherResourceList) { + JSONObject jsonObject = new JSONObject(); + DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + jsonObject.putOnce("begTime", dtf.format(weatherResource.getLastBegTime())); + jsonObject.putOnce("endTime", dtf.format(weatherResource.getLastEndTime())); + weatherMsgArray.add(jsonObject); + responseCmdInfo.setCmdType("66-" + weatherResource.getWeatherType()); + } + responseCmdInfo.setData(weatherMsgArray); + Global.sendCmdInfoQueue.add(responseCmdInfo); + }catch (Exception ex){ + ex.printStackTrace(); + log.error(ex.getMessage()); + } + } private void taskTrigger(Scenario currentScenario, String roomId) { - Object statusObj = redisUtil.hget(roomId + "_" + currentScenario.getId(), "status"); - if (statusObj != null && statusObj.toString().equals("running")) { - Object taskListObj = redisUtil.hget(roomId + "_" + currentScenario.getId(), "taskList"); - if (taskListObj != null) { - if (taskListObj instanceof List) { - List taskList = (List) taskListObj; - for (Object task : taskList) { - ScenarioTask scenarioTask = (ScenarioTask) task; - ResponseCmdInfo> cmdInfo = new ResponseCmdInfo<>(); - Map dataMap = new HashMap<>(); - cmdInfo.setData(dataMap); - dataMap.put("resourceId", scenarioTask.getResourceId()); - - if (!"running".equals(scenarioTask.getStatus())) { - scenarioTask.setStatus("running"); - - String url = pathPlanningUrl + "?profile=car&point=" + scenarioTask.getFromLat() + "," - + scenarioTask.getFromLng() - + "&point=" + scenarioTask.getToLat() + "," + scenarioTask.getToLng() - + "&points_encoded=false&algorithm=alternative_route&alternative_route.max_paths=3"; - String result = webClient.get() - .uri(url) - .retrieve() - .bodyToMono(String.class) - .block(); - JSONObject resultObject = JSON.parseObject(result); - if (resultObject != null) { - cmdInfo.setCmdType("init_path_planning"); - cmdInfo.setScenarioId(scenarioTask.getScenarioId()); - cmdInfo.setRoom(roomId); - - dataMap.put("points", resultObject); - - redisUtil.hset(roomId + "_" + currentScenario.getId(), - scenarioTask.getId() + "_path_points", resultObject.getJSONArray("paths")); - } - - } else {//更新坐标 - List points = new ArrayList<>(); - cmdInfo.setCmdType("current_position"); - Object pathsObj = redisUtil.hget(roomId + "_" + currentScenario.getId(), - scenarioTask.getId() + "_path_points"); - if (pathsObj != null) { - JSONArray paths = (JSONArray) pathsObj; - JSONObject jsonObject = (JSONObject) paths.get(0); - JSONArray pointsArray = JSONArray.of(jsonObject.getJSONObject("paths") - .getJSONObject("points").getJSONArray("coordinates")); - - for (int i = 0; i < pointsArray.size(); i++) { - JSONArray coordinateArray = pointsArray.getJSONArray(i); - double[] data = new double[coordinateArray.size()]; - for (int j = 0; j < coordinateArray.size(); j++) { - data[j] = coordinateArray.getDouble(j); - } - points.add(data); - } - } - //查看当前想定持续的时间 - Object duringObj = redisUtil.hget(roomId + "_" + currentScenario.getId(), - "duringTime"); - if (duringObj != null) { - int oldValue = duringObj instanceof Integer ? (Integer) duringObj : 0; - double[] currentPosition = MultiPointGeoPosition.getPosition(points, SPEED, - oldValue); - dataMap.put("currentPosition", currentPosition); - } - } - Global.sendCmdInfoQueue.add(cmdInfo); - } - } - } - } } - private void supplierChangeUseUp(Scenario currentScenario, String roomId) { } @@ -211,7 +158,7 @@ public class ScenarioTaskServiceImpl extends public List queryTaskList(ScenarioTask task) { QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.eq("scenario_id", task.getScenarioId()); - if (StringUtils.isNotBlank(task.getResourceId())) { + if(StringUtils.isNotBlank(task.getResourceId())){ queryWrapper.eq("resource_id", task.getResourceId()); } return this.list(queryWrapper); diff --git a/src/main/java/com/hivekion/scenario/service/impl/VehicleServiceImpl.java b/src/main/java/com/hivekion/scenario/service/impl/VehicleServiceImpl.java new file mode 100644 index 0000000..a2d3607 --- /dev/null +++ b/src/main/java/com/hivekion/scenario/service/impl/VehicleServiceImpl.java @@ -0,0 +1,20 @@ +package com.hivekion.scenario.service.impl; + +import com.hivekion.scenario.entity.Vehicle; +import com.hivekion.scenario.mapper.VehicleMapper; +import com.hivekion.scenario.service.IVehicleService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 车辆信息表 服务实现类 + *

+ * + * @author liDongYu + * @since 2025-09-13 + */ +@Service +public class VehicleServiceImpl extends ServiceImpl implements IVehicleService { + +} diff --git a/src/main/resources/mapper/tbl/ResourceMapper.xml b/src/main/resources/mapper/tbl/ResourceMapper.xml new file mode 100644 index 0000000..b389bd0 --- /dev/null +++ b/src/main/resources/mapper/tbl/ResourceMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/src/main/resources/mapper/tbl/ResourceVehicleRelaMapper.xml b/src/main/resources/mapper/tbl/ResourceVehicleRelaMapper.xml new file mode 100644 index 0000000..dec86f8 --- /dev/null +++ b/src/main/resources/mapper/tbl/ResourceVehicleRelaMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/src/main/resources/mapper/tbl/VehicleMapper.xml b/src/main/resources/mapper/tbl/VehicleMapper.xml new file mode 100644 index 0000000..8332c70 --- /dev/null +++ b/src/main/resources/mapper/tbl/VehicleMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/src/main/resources/mapper/tbl/WeatherResourceMapper.xml b/src/main/resources/mapper/tbl/WeatherResourceMapper.xml new file mode 100644 index 0000000..069c31d --- /dev/null +++ b/src/main/resources/mapper/tbl/WeatherResourceMapper.xml @@ -0,0 +1,5 @@ + + + + +