天气
This commit is contained in:
parent
ffdcf16683
commit
e02e19c2d1
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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,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