摄像头code
This commit is contained in:
parent
e3223b5618
commit
b92119dd75
@ -0,0 +1,19 @@
|
||||
package cn.iocoder.yudao.module.mqtt.api.path.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PathToRobotChangeXYArgDTO {
|
||||
private List<PathToRobotChangeXYArgMovePoseDTO> pose2ds;
|
||||
private PathToRobotChangeXYArgPoseDTO backPose;
|
||||
private PathToRobotChangeXYArgPoseDTO cargoPose;
|
||||
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package cn.iocoder.yudao.module.mqtt.api.path.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PathToRobotChangeXYArgMovePoseDTO {
|
||||
/**
|
||||
* 开始控制点x轴
|
||||
*/
|
||||
private Double actualBeginControlX;
|
||||
/**
|
||||
* 开始控制点y轴
|
||||
*/
|
||||
private Double actualBeginControlY;
|
||||
|
||||
/**
|
||||
* 结束控制点x轴
|
||||
*/
|
||||
private Double actualEndControlX;
|
||||
/**
|
||||
* 结束控制点y轴
|
||||
*/
|
||||
private Double actualEndControlY;
|
||||
|
||||
private String id;
|
||||
|
||||
private Integer isEndPose;
|
||||
private Integer isOldPose;
|
||||
private Boolean isStraightEdge;
|
||||
private String poseId;
|
||||
private Double speed;
|
||||
private Double x;
|
||||
private Double y;
|
||||
private Double yaw;
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package cn.iocoder.yudao.module.mqtt.api.path.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PathToRobotChangeXYArgPoseDTO {
|
||||
/**
|
||||
* 开始控制点x轴
|
||||
*/
|
||||
private Double actualBeginControlX;
|
||||
/**
|
||||
* 开始控制点y轴
|
||||
*/
|
||||
private Double actualBeginControlY;
|
||||
|
||||
/**
|
||||
* 结束控制点x轴
|
||||
*/
|
||||
private Double actualEndControlX;
|
||||
/**
|
||||
* 结束控制点y轴
|
||||
*/
|
||||
private Double actualEndControlY;
|
||||
|
||||
private String id;
|
||||
|
||||
private Boolean isStraightEdge;
|
||||
private Double speed;
|
||||
private Double x;
|
||||
private Double y;
|
||||
private Double yaw;
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package cn.iocoder.yudao.module.mqtt.api.path.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PathToRobotChangeXYDTO {
|
||||
//这个实体类不要修改
|
||||
//这个实体类不要修改
|
||||
//这个实体类不要修改
|
||||
//这个实体类不要修改
|
||||
//这个实体类不要修改
|
||||
private String executionType;
|
||||
private String orderId;
|
||||
private String orderType;
|
||||
private String robotNo;
|
||||
private String taskType;
|
||||
|
||||
private PathToRobotChangeXYDataDTO data;
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package cn.iocoder.yudao.module.mqtt.api.path.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PathToRobotChangeXYDataDTO {
|
||||
private PathToRobotChangeXYArgDTO arg;
|
||||
private String commandType;
|
||||
private Integer isCommandEnd;
|
||||
}
|
@ -21,5 +21,6 @@ public class PathToRobotDTO {
|
||||
private Integer isCommandEnd;
|
||||
private String robotNo;
|
||||
private String commandType;
|
||||
private String taskType;
|
||||
private PathToRobotArgDTO arg;
|
||||
}
|
||||
|
@ -75,6 +75,14 @@ public class DeviceInformationController {
|
||||
return success(BeanUtils.toBean(information, DeviceInformationRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/getCameraCode")
|
||||
@Operation(summary = "获得设备信息的摄像头code")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('device:information:getCameraCode')")
|
||||
public CommonResult<String> getCameraCode(@RequestParam("id") Long id) throws Exception {
|
||||
return success(informationService.getCameraCode(id));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "获得设备信息列表")
|
||||
public CommonResult<List<DeviceInformationRespVO>> getList(@Valid DeviceInformationDTO dto) {
|
||||
|
@ -45,4 +45,10 @@ public class RobotModelPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "转弯半径(单位米)")
|
||||
private String robotTurningRadius;
|
||||
|
||||
@Schema(description = "X轴偏移量")
|
||||
private String robotXOffset;
|
||||
|
||||
@Schema(description = "Y轴偏移量")
|
||||
private String robotYOffset;
|
||||
}
|
@ -49,4 +49,10 @@ public class RobotModelRespVO {
|
||||
|
||||
@Schema(description = "转弯半径(单位米)")
|
||||
private String robotTurningRadius;
|
||||
|
||||
@Schema(description = "X轴偏移量")
|
||||
private String robotXOffset;
|
||||
|
||||
@Schema(description = "Y轴偏移量")
|
||||
private String robotYOffset;
|
||||
}
|
@ -36,4 +36,10 @@ public class RobotModelSaveReqVO {
|
||||
|
||||
@Schema(description = "转弯半径(单位米)")
|
||||
private String robotTurningRadius;
|
||||
|
||||
@Schema(description = "X轴偏移量")
|
||||
private String robotXOffset;
|
||||
|
||||
@Schema(description = "Y轴偏移量")
|
||||
private String robotYOffset;
|
||||
}
|
@ -67,4 +67,14 @@ public class RobotModelDO extends BaseDO {
|
||||
*/
|
||||
private String robotTurningRadius;
|
||||
|
||||
/**
|
||||
* X轴偏移量
|
||||
*/
|
||||
private String robotXOffset;
|
||||
|
||||
/**
|
||||
* Y轴偏移量
|
||||
*/
|
||||
private String robotYOffset;
|
||||
|
||||
}
|
@ -143,4 +143,11 @@ public interface DeviceInformationService extends IService<DeviceInformationDO>
|
||||
* @param id
|
||||
*/
|
||||
void deleteDeviceByMapId(Long id);
|
||||
|
||||
/**
|
||||
* 获取摄像头code
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
String getCameraCode(Long id) throws Exception;
|
||||
}
|
||||
|
@ -474,6 +474,16 @@ public class DeviceInformationServiceImpl extends ServiceImpl<DeviceInformationM
|
||||
informationMapper.deleteDeviceByMapId(mapId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCameraCode(Long id) throws Exception {
|
||||
DeviceInformationDO deviceInformationDO = informationMapper.selectById(id);
|
||||
if (ObjectUtil.isEmpty(deviceInformationDO.getCameraCode()) || !DeviceTypeEnum.CAMERA.getType().equals(deviceInformationDO.getDeviceType())) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return AESEncryptionUtil.decrypt(deviceInformationDO.getCameraCode(), cameraSecretKey);
|
||||
}
|
||||
|
||||
public void shrink(String ip, int port, String deviceNo) {
|
||||
boolean success = true;
|
||||
short[] shrinkArr = {0};
|
||||
|
@ -27,10 +27,12 @@ import cn.iocoder.yudao.module.system.dal.dataobject.positionmap.PositionMapDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.positionmap.PositionMapItemDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.positionmap.PositionMapLineDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotInformationDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotModelDO;
|
||||
import cn.iocoder.yudao.module.system.dal.mysql.positionmap.PositionMapItemMapper;
|
||||
import cn.iocoder.yudao.module.system.dal.mysql.positionmap.PositionMapLineMapper;
|
||||
import cn.iocoder.yudao.module.system.dal.mysql.positionmap.PositionMapMapper;
|
||||
import cn.iocoder.yudao.module.system.dal.mysql.robot.RobotInformationMapper;
|
||||
import cn.iocoder.yudao.module.system.enums.common.ZeroOneEnum;
|
||||
import cn.iocoder.yudao.module.system.enums.config.CommandConfigTypeEnum;
|
||||
import cn.iocoder.yudao.module.system.enums.item.PositionMapItemEnum;
|
||||
import cn.iocoder.yudao.module.system.enums.line.DirectionEnum;
|
||||
@ -45,6 +47,7 @@ import cn.iocoder.yudao.module.system.service.positionmap.PositionMapItemService
|
||||
import cn.iocoder.yudao.module.system.service.positionmap.PositionMapService;
|
||||
import cn.iocoder.yudao.module.system.service.remote.RemoteControllerInformationService;
|
||||
import cn.iocoder.yudao.module.system.service.robot.RobotInformationService;
|
||||
import cn.iocoder.yudao.module.system.service.robot.RobotModelService;
|
||||
import cn.iocoder.yudao.module.system.util.redis.RedisUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -121,6 +124,9 @@ public class PathPlanningServiceImpl implements PathPlanningService {
|
||||
@Resource
|
||||
private RobotTaskDetailActionLogService taskDetailActionLogService;
|
||||
|
||||
@Resource
|
||||
private RobotModelService modelService;
|
||||
|
||||
/**
|
||||
* 同步ware_position_map_line的点位信息
|
||||
*/
|
||||
@ -447,38 +453,67 @@ public class PathPlanningServiceImpl implements PathPlanningService {
|
||||
String mac = robotInformationService.getMacByRobotNo(pathRobotDTO.getRobotNo());
|
||||
String topic = RobotTopicConstant.ROBOT_TASK_MOVE_TOPIC + mac;
|
||||
if(RobotCommandTypeEnum.SWITCH_MAP.getType().equals(pathRobotDTO.getCommandType())) {
|
||||
String mapFileName = positionMapService.getMapFileNameByFloorAndAreaName(pathRobotDTO.getArg().getFloor(),pathRobotDTO.getArg().getAreaId());
|
||||
pathRobotDTO.getArg().setMapName(mapFileName);
|
||||
controllerInformationService.robotChangeSpeed(pathRobotDTO);
|
||||
commonApi.commonMethodStr(JSON.toJSONString(pathRobotDTO), topic);
|
||||
RobotTaskDetailActionLogDO actionLog = taskDetailActionLogService.getLastTaskByRobotNo(pathRobotDTO.getRobotNo(),null);
|
||||
if (ObjectUtil.isNotEmpty(actionLog)) {
|
||||
//为了统计各个地图的工作时间
|
||||
RobotTaskDetailActionLogSaveReqVO data = new RobotTaskDetailActionLogSaveReqVO();
|
||||
data.setActionMsg(actionLog.getRobotNo() + " 切换为 " + pathRobotDTO.getArg().getFloor()+"层 " + pathRobotDTO.getArg().getAreaId());
|
||||
data.setRobotNo(actionLog.getRobotNo());
|
||||
data.setTaskDetailId(actionLog.getTaskDetailId());
|
||||
data.setTaskStage(actionLog.getTaskStage());
|
||||
data.setCommandType(actionLog.getCommandType());
|
||||
data.setTaskNo(actionLog.getTaskNo());
|
||||
data.setActionStatus(actionLog.getActionStatus());
|
||||
data.setStartTime(LocalDateTime.now());
|
||||
Long mapId = robotInformationService.getRobotMapIdByRobotNo(actionLog.getRobotNo());
|
||||
if (ObjectUtil.isNotEmpty(mapId)) {
|
||||
data.setPositionMapId(mapId);
|
||||
}
|
||||
taskDetailActionLogService.createTaskDetailActionLog(data);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(actionLog) && ObjectUtil.isNotEmpty(actionLog.getStartTime())) {
|
||||
Duration duration = Duration.between(actionLog.getCreateTime(), LocalDateTime.now());
|
||||
actionLog.setDuration(duration.toMinutes());
|
||||
taskDetailActionLogService.updateTaskDetailActionLogs(Collections.singletonList(actionLog));
|
||||
}
|
||||
}else {
|
||||
switchMap(pathRobotDTO,topic);
|
||||
} else if (RobotCommandTypeEnum.WORD_DROP_OFF_GOODS.getType().equals(pathRobotDTO.getCommandType())) {
|
||||
wordDropOffGoods(message,topic,pathRobotDTO.getRobotNo());
|
||||
} else {
|
||||
commonApi.commonMethodStr(message, topic);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 适配不同车型的放货点
|
||||
* @param message
|
||||
* @param topic
|
||||
*/
|
||||
private void wordDropOffGoods(String message, String topic, String robotNo) {
|
||||
RobotInformationDO robotInformation = robotInformationService.getInformationByRobotNo(robotNo);
|
||||
RobotModelDO model = modelService.getModel(robotInformation.getRobotModelId());
|
||||
if (String.valueOf(ZeroOneEnum.ZERO.getType()).equals(model.getRobotXOffset())
|
||||
&& String.valueOf(ZeroOneEnum.ZERO.getType()).equals(model.getRobotYOffset())) {
|
||||
commonApi.commonMethodStr(message, topic);
|
||||
return;
|
||||
}
|
||||
PathToRobotChangeXYDTO pathToRobotChangeXY = JSON.parseObject(message, PathToRobotChangeXYDTO.class);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 统计时间使用
|
||||
* @param pathRobotDTO
|
||||
* @param topic
|
||||
*/
|
||||
public void switchMap(PathToRobotDTO pathRobotDTO,String topic ) {
|
||||
String mapFileName = positionMapService.getMapFileNameByFloorAndAreaName(pathRobotDTO.getArg().getFloor(),pathRobotDTO.getArg().getAreaId());
|
||||
pathRobotDTO.getArg().setMapName(mapFileName);
|
||||
controllerInformationService.robotChangeSpeed(pathRobotDTO);
|
||||
commonApi.commonMethodStr(JSON.toJSONString(pathRobotDTO), topic);
|
||||
RobotTaskDetailActionLogDO actionLog = taskDetailActionLogService.getLastTaskByRobotNo(pathRobotDTO.getRobotNo(),null);
|
||||
if (ObjectUtil.isNotEmpty(actionLog)) {
|
||||
//为了统计各个地图的工作时间
|
||||
RobotTaskDetailActionLogSaveReqVO data = new RobotTaskDetailActionLogSaveReqVO();
|
||||
data.setActionMsg(actionLog.getRobotNo() + " 切换为 " + pathRobotDTO.getArg().getFloor()+"层 " + pathRobotDTO.getArg().getAreaId());
|
||||
data.setRobotNo(actionLog.getRobotNo());
|
||||
data.setTaskDetailId(actionLog.getTaskDetailId());
|
||||
data.setTaskStage(actionLog.getTaskStage());
|
||||
data.setCommandType(actionLog.getCommandType());
|
||||
data.setTaskNo(actionLog.getTaskNo());
|
||||
data.setActionStatus(actionLog.getActionStatus());
|
||||
data.setStartTime(LocalDateTime.now());
|
||||
Long mapId = robotInformationService.getRobotMapIdByRobotNo(actionLog.getRobotNo());
|
||||
if (ObjectUtil.isNotEmpty(mapId)) {
|
||||
data.setPositionMapId(mapId);
|
||||
}
|
||||
taskDetailActionLogService.createTaskDetailActionLog(data);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(actionLog) && ObjectUtil.isNotEmpty(actionLog.getStartTime())) {
|
||||
Duration duration = Duration.between(actionLog.getCreateTime(), LocalDateTime.now());
|
||||
actionLog.setDuration(duration.toMinutes());
|
||||
taskDetailActionLogService.updateTaskDetailActionLogs(Collections.singletonList(actionLog));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 实时行为上报
|
||||
* @param orderId
|
||||
|
Loading…
Reference in New Issue
Block a user