feat(system): 添加机器人状态测试接口并优化数据处理
- 在 RobotInformationController 中添加 test 接口,用于测试机器人状态 - 在 RobotInformationService 中添加 test 方法,处理机器人状态数据 - 在 HouseAreaService 中修改 getHouseAreaList 方法,增加 positionMapId 参数- 在 application-local.yaml 中更新数据库连接 URL,添加 allowMultiQueries 参数 - 新增 RequestProcessor 类,用于处理和发送机器人状态数据
This commit is contained in:
parent
8565c226cf
commit
22c8eca028
@ -6,7 +6,6 @@ import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.module.system.api.robot.dto.RobotStatusDTO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.robot.vo.*;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotInformationDO;
|
||||
import cn.iocoder.yudao.module.system.service.robot.RobotInformationService;
|
||||
@ -18,7 +17,6 @@ import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.annotation.security.PermitAll;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
@ -37,14 +35,6 @@ public class RobotInformationController {
|
||||
@Resource
|
||||
private RobotInformationService informationService;
|
||||
|
||||
@PostMapping("/test")
|
||||
@Operation(summary = "测试")
|
||||
@PermitAll
|
||||
public CommonResult<Boolean> test(@RequestBody RobotStatusDTO dto) {
|
||||
informationService.test(dto);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建车辆信息")
|
||||
@PreAuthorize("@ss.hasPermission('robot:information:create')")
|
||||
|
@ -1,13 +1,12 @@
|
||||
package cn.iocoder.yudao.module.system.service.robot;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.module.system.api.robot.dto.RobotStatusDTO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.robot.vo.*;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotInformationDO;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 车辆信息 Service 接口
|
||||
*
|
||||
@ -55,32 +54,30 @@ public interface RobotInformationService {
|
||||
|
||||
/**
|
||||
* 统计车辆待命/任务中/离线
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
RobotInformationStatisticsVO statisticsInformation();
|
||||
|
||||
/**
|
||||
* 查询能正常使用的车辆
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<RobotInformationDO> getCanUseRobot();
|
||||
|
||||
/**
|
||||
* 查询所有车辆
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<RobotInformationDO> getAllRobot();
|
||||
|
||||
/**
|
||||
* 查询机器人编号
|
||||
*
|
||||
* @param mac
|
||||
* @return
|
||||
*/
|
||||
String getRobotNoByMac(String mac);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param dto
|
||||
*/
|
||||
void test(@Valid RobotStatusDTO dto);
|
||||
}
|
||||
|
@ -5,9 +5,7 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
|
||||
import cn.iocoder.yudao.module.system.api.robot.RequestProcessor;
|
||||
import cn.iocoder.yudao.module.system.api.robot.dto.RobotStatusDTO;
|
||||
import cn.iocoder.yudao.module.system.api.robot.dto.RobotStatusDataPoseDTO;
|
||||
import cn.iocoder.yudao.module.system.constant.robot.RobotTaskChcheConstant;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.robot.vo.*;
|
||||
@ -55,8 +53,6 @@ public class RobotInformationServiceImpl implements RobotInformationService {
|
||||
|
||||
@Resource
|
||||
private RedisUtil redisUtil;
|
||||
@Resource
|
||||
private RequestProcessor processor;
|
||||
|
||||
@Override
|
||||
public Long createInformation(RobotInformationSaveReqVO createReqVO) {
|
||||
@ -162,6 +158,7 @@ public class RobotInformationServiceImpl implements RobotInformationService {
|
||||
|
||||
/**
|
||||
* 设置状态和信息
|
||||
*
|
||||
* @param v
|
||||
*/
|
||||
private void setMsgAndRobotStatus(RobotInformationPageRespVO v) {
|
||||
@ -214,6 +211,7 @@ public class RobotInformationServiceImpl implements RobotInformationService {
|
||||
|
||||
/**
|
||||
* 统计车辆待命/任务中/离线
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@ -271,7 +269,6 @@ public class RobotInformationServiceImpl implements RobotInformationService {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@ -289,6 +286,7 @@ public class RobotInformationServiceImpl implements RobotInformationService {
|
||||
|
||||
/**
|
||||
* 根据mac查询机器人编号
|
||||
*
|
||||
* @param mac
|
||||
* @return
|
||||
*/
|
||||
@ -313,23 +311,4 @@ public class RobotInformationServiceImpl implements RobotInformationService {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void test(RobotStatusDTO robotStatusDataDTO) {
|
||||
TenantContextHolder.setTenantId(1L);
|
||||
if (ObjectUtil.isEmpty(robotStatusDataDTO) || ObjectUtil.isEmpty(robotStatusDataDTO.getMac())) {
|
||||
return;
|
||||
}
|
||||
RobotStatusDataPoseDTO robotStatusDataPoseDTO = new RobotStatusDataPoseDTO();
|
||||
robotStatusDataPoseDTO.setX(robotStatusDataDTO.getData().getPose2d().getX());
|
||||
robotStatusDataPoseDTO.setY(robotStatusDataDTO.getData().getPose2d().getY());
|
||||
robotStatusDataPoseDTO.setYaw(robotStatusDataDTO.getData().getPose2d().getYaw());
|
||||
robotStatusDataPoseDTO.setFloor(robotStatusDataDTO.getData().getFloor_zone().getFloor());
|
||||
robotStatusDataPoseDTO.setArea(robotStatusDataDTO.getData().getFloor_zone().getArea());
|
||||
robotStatusDataPoseDTO.setBat_soc(robotStatusDataDTO.getData().getPose2d().getBat_soc());
|
||||
// 模拟请求
|
||||
processor.handleRequest(robotStatusDataDTO.getData().getFloor_zone().getFloor() + "_" + robotStatusDataDTO.getData().getFloor_zone().getArea(),
|
||||
robotStatusDataDTO.getMac(), JSONUtil.toJsonStr(robotStatusDataPoseDTO));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user