Compare commits
7 Commits
cd52301d5e
...
a326ac143f
Author | SHA1 | Date | |
---|---|---|---|
![]() |
a326ac143f | ||
![]() |
0a3498bc7e | ||
![]() |
22c8eca028 | ||
![]() |
8565c226cf | ||
![]() |
c1a17a839b | ||
![]() |
c381315892 | ||
![]() |
12eb16047c |
@ -0,0 +1,61 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.api.robot;
|
||||||
|
|
||||||
|
import cn.hutool.core.map.MapUtil;
|
||||||
|
import cn.iocoder.yudao.module.infra.api.websocket.WebSocketSenderApi;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.annotation.PreDestroy;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Slf4j
|
||||||
|
public class RequestProcessor {
|
||||||
|
private final ConcurrentHashMap<String, ConcurrentHashMap<String, String>> cache = new ConcurrentHashMap<>();
|
||||||
|
private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
public WebSocketSenderApi webSocketSenderApi;
|
||||||
|
|
||||||
|
public RequestProcessor() {
|
||||||
|
// 每秒执行一次 - 处理并发送数据 - 避免数据丢失
|
||||||
|
scheduler.scheduleAtFixedRate(this::processAndSend, 1, 1, TimeUnit.SECONDS);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleRequest(String map, String mac, String data) {
|
||||||
|
cache.computeIfAbsent(map, k -> new ConcurrentHashMap<>()).put(mac, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void processAndSend() {
|
||||||
|
Map<String, ConcurrentHashMap<String, String>> snapshot = new ConcurrentHashMap<>(cache); // 创建快照
|
||||||
|
cache.clear(); // 先清理缓存
|
||||||
|
for (Map.Entry<String, ConcurrentHashMap<String, String>> entry : snapshot.entrySet()) {
|
||||||
|
if (!MapUtil.isEmpty(entry.getValue())) {
|
||||||
|
sendData(entry.getKey(), entry.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sendData(String map, Map<String, String> data) {
|
||||||
|
// -- 发送给对应的websocket
|
||||||
|
// System.out.println("key:" + map + "发送数据:" + data);
|
||||||
|
log.info("key:" + map + "发送数据:" + data);
|
||||||
|
webSocketSenderApi.sendObject(map, "map_push", data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void shutdown() {
|
||||||
|
scheduler.shutdown();
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreDestroy
|
||||||
|
public void destroy() {
|
||||||
|
// 在Bean销毁前关闭去啊
|
||||||
|
shutdown();
|
||||||
|
}
|
||||||
|
}
|
@ -19,6 +19,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.scheduling.annotation.Async;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
@ -28,6 +29,8 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.module.system.config.SystemJobConfiguration.NOTIFY_THREAD_POOL_TASK_EXECUTOR;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
||||||
@Validated
|
@Validated
|
||||||
@ -48,12 +51,20 @@ public class RobotStatusApiImpl implements RobotStatusApi {
|
|||||||
@Value("${zn.robot_position_cache_time:600}")
|
@Value("${zn.robot_position_cache_time:600}")
|
||||||
private Long robotPositionCacheTime;
|
private Long robotPositionCacheTime;
|
||||||
|
|
||||||
|
@Value("${zn.robot_error_level_time:30}")
|
||||||
|
private Long robotErrorLevelTime;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private RequestProcessor processor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新机器人点位/异常/能否做任务
|
* 更新机器人点位/异常/能否做任务
|
||||||
|
*
|
||||||
* @param robotStatusDataDTO
|
* @param robotStatusDataDTO
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@Async(NOTIFY_THREAD_POOL_TASK_EXECUTOR)
|
||||||
public void robotStatusUpdate(RobotStatusDTO robotStatusDataDTO) {
|
public void robotStatusUpdate(RobotStatusDTO robotStatusDataDTO) {
|
||||||
TenantContextHolder.setTenantId(1L);
|
TenantContextHolder.setTenantId(1L);
|
||||||
if (ObjectUtil.isEmpty(robotStatusDataDTO) || ObjectUtil.isEmpty(robotStatusDataDTO.getMac())) {
|
if (ObjectUtil.isEmpty(robotStatusDataDTO) || ObjectUtil.isEmpty(robotStatusDataDTO.getMac())) {
|
||||||
@ -61,26 +72,31 @@ public class RobotStatusApiImpl implements RobotStatusApi {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String taskStatusKey = RobotTaskChcheConstant.ROBOT_TASK_STATUS +robotStatusDataDTO.getMac();
|
String taskStatusKey = RobotTaskChcheConstant.ROBOT_TASK_STATUS + robotStatusDataDTO.getMac();
|
||||||
String cargoDetectedKey = RobotTaskChcheConstant.ROBOT_CARGO_DETECTED +robotStatusDataDTO.getMac();
|
String cargoDetectedKey = RobotTaskChcheConstant.ROBOT_CARGO_DETECTED + robotStatusDataDTO.getMac();
|
||||||
String pose2dKey = RobotTaskChcheConstant.ROBOT_INFORMATION_POSE_BAT_SOC +robotStatusDataDTO.getMac();
|
String pose2dKey = RobotTaskChcheConstant.ROBOT_INFORMATION_POSE_BAT_SOC + robotStatusDataDTO.getMac();
|
||||||
redisUtil.set(taskStatusKey, robotStatusDataDTO.getData().getTask_status(),robotPositionCacheTime);
|
redisUtil.set(taskStatusKey, robotStatusDataDTO.getData().getTask_status(), robotPositionCacheTime);
|
||||||
redisUtil.set(cargoDetectedKey,robotStatusDataDTO.getData().getCargo_detected(),robotPositionCacheTime);
|
redisUtil.set(cargoDetectedKey, robotStatusDataDTO.getData().getCargo_detected(), robotPositionCacheTime);
|
||||||
|
|
||||||
Object object = redisUtil.get(pose2dKey);
|
Object object = redisUtil.get(pose2dKey);
|
||||||
RobotStatusDataPoseDTO robotStatusDataPoseDTO= JSONUtil.toBean((String)object, RobotStatusDataPoseDTO.class);
|
RobotStatusDataPoseDTO robotStatusDataPoseDTO = JSONUtil.toBean((String) object, RobotStatusDataPoseDTO.class);
|
||||||
robotStatusDataPoseDTO.setX(robotStatusDataDTO.getData().getPose2d().getX());
|
robotStatusDataPoseDTO.setX(robotStatusDataDTO.getData().getPose2d().getX());
|
||||||
robotStatusDataPoseDTO.setY(robotStatusDataDTO.getData().getPose2d().getY());
|
robotStatusDataPoseDTO.setY(robotStatusDataDTO.getData().getPose2d().getY());
|
||||||
robotStatusDataPoseDTO.setYaw(robotStatusDataDTO.getData().getPose2d().getYaw());
|
robotStatusDataPoseDTO.setYaw(robotStatusDataDTO.getData().getPose2d().getYaw());
|
||||||
robotStatusDataPoseDTO.setFloor(robotStatusDataDTO.getData().getPose2d().getFloor());
|
robotStatusDataPoseDTO.setFloor(robotStatusDataDTO.getData().getFloor_zone().getFloor());
|
||||||
robotStatusDataPoseDTO.setArea(robotStatusDataDTO.getData().getPose2d().getArea());
|
robotStatusDataPoseDTO.setArea(robotStatusDataDTO.getData().getFloor_zone().getArea());
|
||||||
redisUtil.set(pose2dKey,JSON.toJSONString(robotStatusDataPoseDTO),robotPositionCacheTime);
|
redisUtil.set(pose2dKey, JSON.toJSONString(robotStatusDataPoseDTO), robotPositionCacheTime);
|
||||||
|
|
||||||
|
// 合并请求 - 这里接受到的数据都丢给 RequestProcessor - 再整合数据通过WebSocket丢给前端
|
||||||
|
processor.handleRequest(robotStatusDataPoseDTO.getFloor() + "_" + robotStatusDataPoseDTO.getArea(),
|
||||||
|
robotStatusDataDTO.getMac(), JSONUtil.toJsonStr(robotStatusDataDTO.getData().getPose2d()));
|
||||||
|
|
||||||
|
|
||||||
if (ObjectUtil.isNotNull(robotStatusDataDTO.getData().getErr_code())) {
|
if (ObjectUtil.isNotNull(robotStatusDataDTO.getData().getErr_code())) {
|
||||||
List<RobotStatusDataErrorDTO> errCode = robotStatusDataDTO.getData().getErr_code();
|
List<RobotStatusDataErrorDTO> errCode = robotStatusDataDTO.getData().getErr_code();
|
||||||
String robotNo = robotInformationService.getRobotNoByMac(robotStatusDataDTO.getMac());
|
String robotNo = robotInformationService.getRobotNoByMac(robotStatusDataDTO.getMac());
|
||||||
if (ObjectUtil.isNull(robotNo)) {
|
if (ObjectUtil.isNull(robotNo)) {
|
||||||
log.info("查不到机器人编号 :{}",robotStatusDataDTO.getMac());
|
log.info("查不到机器人编号 :{}", robotStatusDataDTO.getMac());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,7 +104,7 @@ public class RobotStatusApiImpl implements RobotStatusApi {
|
|||||||
errCode.stream().map(RobotStatusDataErrorDTO::getError_code).collect(Collectors.toList());
|
errCode.stream().map(RobotStatusDataErrorDTO::getError_code).collect(Collectors.toList());
|
||||||
List<RobotWarnCodeMappingDO> robotWarnCodeMappingDOS =
|
List<RobotWarnCodeMappingDO> robotWarnCodeMappingDOS =
|
||||||
warnCodeMappingMapper.selectList(new LambdaQueryWrapper<RobotWarnCodeMappingDO>()
|
warnCodeMappingMapper.selectList(new LambdaQueryWrapper<RobotWarnCodeMappingDO>()
|
||||||
.in(RobotWarnCodeMappingDO::getWarnCode, warnCodes));
|
.in(RobotWarnCodeMappingDO::getWarnCode, warnCodes));
|
||||||
if (ObjectUtil.isEmpty(robotWarnCodeMappingDOS)) {
|
if (ObjectUtil.isEmpty(robotWarnCodeMappingDOS)) {
|
||||||
log.info("查不对应编号的告警信息 :{}", JSON.toJSONString(warnCodes));
|
log.info("查不对应编号的告警信息 :{}", JSON.toJSONString(warnCodes));
|
||||||
return;
|
return;
|
||||||
@ -99,10 +115,20 @@ public class RobotStatusApiImpl implements RobotStatusApi {
|
|||||||
|
|
||||||
List<RobotWarnMsgDO> warnMsgDOS = new ArrayList<>();
|
List<RobotWarnMsgDO> warnMsgDOS = new ArrayList<>();
|
||||||
|
|
||||||
|
//机器人异常等级
|
||||||
|
String errorLevelKey = RobotTaskChcheConstant.ROBOT_ERROR_LEVEL + robotStatusDataDTO.getMac();
|
||||||
|
Object errorLevel = redisUtil.get(errorLevelKey);
|
||||||
|
|
||||||
|
Integer level = ObjectUtil.isEmpty(errorLevel) ? 0 : Integer.valueOf(errorLevel.toString());
|
||||||
|
|
||||||
for (RobotStatusDataErrorDTO robotStatusData : errCode) {
|
for (RobotStatusDataErrorDTO robotStatusData : errCode) {
|
||||||
|
if (level.intValue() < Integer.valueOf(robotStatusData.getCode_level()).intValue()) {
|
||||||
|
level = Integer.valueOf(robotStatusData.getCode_level());
|
||||||
|
}
|
||||||
|
|
||||||
List<RobotWarnCodeMappingDO> mappingDOS = warnCodeMapping.get(robotStatusData.getError_code());
|
List<RobotWarnCodeMappingDO> mappingDOS = warnCodeMapping.get(robotStatusData.getError_code());
|
||||||
if (ObjectUtil.isEmpty(mappingDOS)) {
|
if (ObjectUtil.isEmpty(mappingDOS)) {
|
||||||
log.info("当前告警类型查不到对应的告警信息 :{}",robotStatusData.getError_code());
|
log.info("当前告警类型查不到对应的告警信息 :{}", robotStatusData.getError_code());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
RobotWarnMsgDO warnMsg = RobotWarnMsgDO.builder().warnLevel(Integer.valueOf(robotStatusData.getCode_level()))
|
RobotWarnMsgDO warnMsg = RobotWarnMsgDO.builder().warnLevel(Integer.valueOf(robotStatusData.getCode_level()))
|
||||||
@ -114,10 +140,11 @@ public class RobotStatusApiImpl implements RobotStatusApi {
|
|||||||
.build();
|
.build();
|
||||||
warnMsgDOS.add(warnMsg);
|
warnMsgDOS.add(warnMsg);
|
||||||
}
|
}
|
||||||
|
redisUtil.set(errorLevelKey, level, robotErrorLevelTime);
|
||||||
|
|
||||||
warnMsgMapper.insertBatch(warnMsgDOS);
|
warnMsgMapper.insertBatch(warnMsgDOS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -22,4 +22,7 @@ public class RobotTaskChcheConstant {
|
|||||||
|
|
||||||
//机器人充电模式 1:自动充电、2:机会充电、3:充满电 (拼接的是机器人编号)
|
//机器人充电模式 1:自动充电、2:机会充电、3:充满电 (拼接的是机器人编号)
|
||||||
public static String ROBOT_CHARGE_MODEL = "robot:information:charge:model";
|
public static String ROBOT_CHARGE_MODEL = "robot:information:charge:model";
|
||||||
|
|
||||||
|
//机器人异常等级 (拼接的是mac地址)
|
||||||
|
public static String ROBOT_ERROR_LEVEL = "robot:information:error:level";
|
||||||
}
|
}
|
||||||
|
@ -82,8 +82,8 @@ public class HouseAreaController {
|
|||||||
@GetMapping("/getHouseAreaList")
|
@GetMapping("/getHouseAreaList")
|
||||||
@Operation(summary = "获得全部库区")
|
@Operation(summary = "获得全部库区")
|
||||||
@PreAuthorize("@ss.hasPermission('ware:house-area:query')")
|
@PreAuthorize("@ss.hasPermission('ware:house-area:query')")
|
||||||
public CommonResult<List<HouseAreaRespVO>> getHouseAreaList() {
|
public CommonResult<List<HouseAreaRespVO>> getHouseAreaList(@RequestParam Long positionMapId) {
|
||||||
List<HouseAreaDO> list = houseAreaService.getHouseAreaList();
|
List<HouseAreaDO> list = houseAreaService.getHouseAreaList(positionMapId);
|
||||||
return success(BeanUtils.toBean(list, HouseAreaRespVO.class));
|
return success(BeanUtils.toBean(list, HouseAreaRespVO.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.system.controller.admin.information;
|
|||||||
|
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.information.dto.DeviceInformationDTO;
|
import cn.iocoder.yudao.module.system.controller.admin.information.dto.DeviceInformationDTO;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.information.dto.MapBindDeviceInfoDTO;
|
import cn.iocoder.yudao.module.system.controller.admin.information.dto.MapBindDeviceInfoDTO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.information.dto.StatisticsInformationDTO;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.information.vo.DeviceInformationPageReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.information.vo.DeviceInformationPageReqVO;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.information.vo.DeviceInformationRespVO;
|
import cn.iocoder.yudao.module.system.controller.admin.information.vo.DeviceInformationRespVO;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.information.vo.DeviceInformationSaveReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.information.vo.DeviceInformationSaveReqVO;
|
||||||
@ -116,4 +117,18 @@ public class DeviceInformationController {
|
|||||||
return success(map);
|
return success(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/deviceNumber")
|
||||||
|
@Operation(summary = "统计设备数量")
|
||||||
|
public CommonResult<List<StatisticsInformationDTO>> getDeviceNumber() {
|
||||||
|
List<StatisticsInformationDTO> list = informationService.getDeviceNumber();
|
||||||
|
return success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/getInformationList")
|
||||||
|
@Operation(summary = "获得所有设备信息(含最后通讯时间)")
|
||||||
|
@PreAuthorize("@ss.hasPermission('device:information:query')")
|
||||||
|
public CommonResult<List<DeviceInformationRespVO>> getInformationList(@Valid DeviceInformationPageReqVO pageReqVO) {
|
||||||
|
List<DeviceInformationDO> list = informationService.getInformationList(pageReqVO);
|
||||||
|
return success(BeanUtils.toBean(list, DeviceInformationRespVO.class));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,13 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.controller.admin.information.dto;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class StatisticsInformationDTO {
|
||||||
|
@Schema(description = "设备类型 字典device_type", example = "2")
|
||||||
|
private Integer deviceType;
|
||||||
|
|
||||||
|
@Schema(description = "设备数量", example = "2")
|
||||||
|
private Integer number = 0;
|
||||||
|
}
|
@ -35,6 +35,7 @@ public class DeviceInformationPageReqVO extends PageParam {
|
|||||||
@Schema(description = "深度")
|
@Schema(description = "深度")
|
||||||
private BigDecimal locationDeep;
|
private BigDecimal locationDeep;
|
||||||
|
|
||||||
|
//1:充电桩,2:输送线,3:码垛机,4:自动门,5:提升机,6:信号灯,7:按钮盒,8:拆垛机
|
||||||
@Schema(description = "设备类型 字典device_type", example = "2")
|
@Schema(description = "设备类型 字典device_type", example = "2")
|
||||||
private Integer deviceType;
|
private Integer deviceType;
|
||||||
|
|
||||||
|
@ -42,6 +42,7 @@ public class DeviceInformationRespVO {
|
|||||||
@ExcelProperty("深度")
|
@ExcelProperty("深度")
|
||||||
private BigDecimal locationDeep;
|
private BigDecimal locationDeep;
|
||||||
|
|
||||||
|
//1:充电桩,2:输送线,3:码垛机,4:自动门,5:提升机,6:信号灯,7:按钮盒,8:拆垛机
|
||||||
@Schema(description = "设备类型 字典device_type", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
@Schema(description = "设备类型 字典device_type", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||||
@ExcelProperty("设备类型 字典device_type")
|
@ExcelProperty("设备类型 字典device_type")
|
||||||
private Integer deviceType;
|
private Integer deviceType;
|
||||||
|
@ -35,6 +35,7 @@ public class DeviceInformationSaveReqVO {
|
|||||||
@Schema(description = "深度")
|
@Schema(description = "深度")
|
||||||
private BigDecimal locationDeep;
|
private BigDecimal locationDeep;
|
||||||
|
|
||||||
|
//1:充电桩,2:输送线,3:码垛机,4:自动门,5:提升机,6:信号灯,7:按钮盒,8:拆垛机
|
||||||
@Schema(description = "设备类型 字典device_type", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
@Schema(description = "设备类型 字典device_type", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||||
@NotNull(message = "设备类型不能为空")
|
@NotNull(message = "设备类型不能为空")
|
||||||
private Integer deviceType;
|
private Integer deviceType;
|
||||||
|
@ -0,0 +1,37 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.controller.admin.path;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.robot.vo.RobotInformationSaveReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.service.path.PathPlanningService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.validation.Valid;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 同步信息给路径规划")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/system/path/planning")
|
||||||
|
@Validated
|
||||||
|
public class PathPlanningController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private PathPlanningService pathPlanningService;
|
||||||
|
|
||||||
|
@PutMapping("/synchronousPoint")
|
||||||
|
@Operation(summary = "同步全部的点位信息")
|
||||||
|
@PreAuthorize("@ss.hasPermission('robot:information:synchronousPoint')")
|
||||||
|
public CommonResult<String> synchronousPoint() {
|
||||||
|
pathPlanningService.synchronousPoint();
|
||||||
|
return success("同步完成");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -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.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||||
import cn.iocoder.yudao.module.infra.api.websocket.WebSocketSenderApi;
|
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.robot.vo.*;
|
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.dal.dataobject.robot.RobotInformationDO;
|
||||||
import cn.iocoder.yudao.module.system.service.robot.RobotInformationService;
|
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 org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.annotation.security.PermitAll;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -36,8 +34,6 @@ public class RobotInformationController {
|
|||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private RobotInformationService informationService;
|
private RobotInformationService informationService;
|
||||||
@Resource
|
|
||||||
private WebSocketSenderApi webSocketSenderApi;
|
|
||||||
|
|
||||||
@PostMapping("/create")
|
@PostMapping("/create")
|
||||||
@Operation(summary = "创建车辆信息")
|
@Operation(summary = "创建车辆信息")
|
||||||
@ -46,14 +42,6 @@ public class RobotInformationController {
|
|||||||
return success(informationService.createInformation(createReqVO));
|
return success(informationService.createInformation(createReqVO));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/test")
|
|
||||||
@PermitAll
|
|
||||||
@Operation(summary = "测试")
|
|
||||||
public CommonResult<Boolean> test(@RequestParam String id, @RequestParam String msg) {
|
|
||||||
webSocketSenderApi.sendObject(id,"map_push", msg);
|
|
||||||
return success(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@PutMapping("/update")
|
@PutMapping("/update")
|
||||||
@Operation(summary = "更新车辆信息")
|
@Operation(summary = "更新车辆信息")
|
||||||
@PreAuthorize("@ss.hasPermission('robot:information:update')")
|
@PreAuthorize("@ss.hasPermission('robot:information:update')")
|
||||||
@ -124,4 +112,12 @@ public class RobotInformationController {
|
|||||||
return success(BeanUtils.toBean(result, RobotInformationRespVO.class));
|
return success(BeanUtils.toBean(result, RobotInformationRespVO.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/list")
|
||||||
|
@Operation(summary = "获得车辆信息分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('robot:information:list')")
|
||||||
|
public CommonResult<PageResult<RobotInformationPageRespVO>> getRobotList(@Valid RobotInformationPageReqVO pageReqVO) {
|
||||||
|
pageReqVO.setPageSize(300);
|
||||||
|
PageResult<RobotInformationPageRespVO> pageResult = informationService.getInformationPage(pageReqVO);
|
||||||
|
return success(BeanUtils.toBean(pageResult, RobotInformationPageRespVO.class));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,9 @@ public class RobotInformationPageReqVO extends PageParam {
|
|||||||
@Schema(description = "mac地址")
|
@Schema(description = "mac地址")
|
||||||
private String macAddress;
|
private String macAddress;
|
||||||
|
|
||||||
|
@Schema(description = "车辆状态类型(待命:standby, 任务中:inTask, 锁定:doLock, 离线:offline, 充电中:charge, 故障:fault)")
|
||||||
|
private String robotStatisticsType;
|
||||||
|
|
||||||
@Schema(description = "上传图片附件", example = "https://www.iocoder.cn")
|
@Schema(description = "上传图片附件", example = "https://www.iocoder.cn")
|
||||||
private String url;
|
private String url;
|
||||||
|
|
||||||
|
@ -36,8 +36,24 @@ public class RobotInformationPageRespVO {
|
|||||||
@ExcelProperty("电量")
|
@ExcelProperty("电量")
|
||||||
private String electricity;
|
private String electricity;
|
||||||
|
|
||||||
@Schema(description = "状态(0:待命、1:任务中、2:锁定、3:离线、4:充电中、5:故障)", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
@Schema(description = "在线状态/离线状态(0:离线、1:在线)", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||||
@ExcelProperty("状态(0:待命、1:任务中、2:锁定、3:离线、4:充电中、5:故障)")
|
@ExcelProperty("在线状态/离线状态(0:离线、1:在线)")
|
||||||
|
private Integer onlineStatus = 0;
|
||||||
|
|
||||||
|
@Schema(description = "车机状态(0:空闲、1:锁定、2:异常)", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||||
|
@ExcelProperty("车机状态(0:空闲、1:锁定、2:异常)")
|
||||||
|
private Integer robotEssenceStatus = 0;
|
||||||
|
|
||||||
|
@Schema(description = "任务状态(0:待命中、1:处理中、2:充电中)", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||||
|
@ExcelProperty("任务状态(0:待命中、1:处理中、2:充电中)")
|
||||||
|
private Integer robotTaskStatus = 0;
|
||||||
|
|
||||||
|
@Schema(description = "异常等级(0,1,2,3,4)", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||||
|
@ExcelProperty("异常等级(0,1,2,3,4)")
|
||||||
|
private Integer robotCodeLevel = 0;
|
||||||
|
|
||||||
|
@Schema(description = "AGV状态(0:暂停且无任务、1:暂停(有处理中的任务)、2:任务中、3:待命)", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||||
|
@ExcelProperty("AGV状态(0:暂停且无任务、1:暂停(有处理中的任务)、2:任务中、3:待命)")
|
||||||
private Integer robotStatus;
|
private Integer robotStatus;
|
||||||
|
|
||||||
@Schema(description = "自动充电电量")
|
@Schema(description = "自动充电电量")
|
||||||
@ -58,7 +74,7 @@ public class RobotInformationPageRespVO {
|
|||||||
@Schema(description = "mac地址")
|
@Schema(description = "mac地址")
|
||||||
private String macAddress;
|
private String macAddress;
|
||||||
|
|
||||||
@Schema(description = "任务模式(0:拒收任务、1:正常)")
|
@Schema(description = "任务模式(0:拒收任务(锁定)、1:正常)")
|
||||||
private Integer robotTaskModel;
|
private Integer robotTaskModel;
|
||||||
|
|
||||||
@Schema(description = "楼层/区域(json)")
|
@Schema(description = "楼层/区域(json)")
|
||||||
|
@ -59,6 +59,7 @@ public class DeviceInformationDO extends BaseDO {
|
|||||||
*/
|
*/
|
||||||
private BigDecimal locationDeep;
|
private BigDecimal locationDeep;
|
||||||
/**
|
/**
|
||||||
|
* 1:充电桩,2:输送线,3:码垛机,4:自动门,5:提升机,6:信号灯,7:按钮盒,8:拆垛机
|
||||||
* 设备类型 字典device_type
|
* 设备类型 字典device_type
|
||||||
*/
|
*/
|
||||||
private Integer deviceType;
|
private Integer deviceType;
|
||||||
|
@ -10,9 +10,10 @@ import lombok.Getter;
|
|||||||
@Getter
|
@Getter
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public enum CommandConfigTypeEnum {
|
public enum CommandConfigTypeEnum {
|
||||||
ONE(1); //充电设置(页面)
|
CHARG_CONFIG(1,"充电设置(页面)");
|
||||||
/**
|
/**
|
||||||
* 类型
|
* 类型
|
||||||
*/
|
*/
|
||||||
private final Integer type;
|
private final Integer type;
|
||||||
|
private final String msg;
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ import lombok.Getter;
|
|||||||
public enum DeviceTypeEnum {
|
public enum DeviceTypeEnum {
|
||||||
|
|
||||||
CHARGING_STATION(1, "充电桩"),
|
CHARGING_STATION(1, "充电桩"),
|
||||||
Conveyor_line(2, "输送线"),
|
CONVEYOR_LINE(2, "输送线"),
|
||||||
PALLETIZER(3, "码垛机"),
|
PALLETIZER(3, "码垛机"),
|
||||||
AUTOMATIC_DOOR(4, "自动门"),
|
AUTOMATIC_DOOR(4, "自动门"),
|
||||||
HOIST(5, "提升机"),
|
HOIST(5, "提升机"),
|
||||||
|
@ -0,0 +1,22 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.enums.device;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum PictureConfigEnum {
|
||||||
|
|
||||||
|
DEFAULT(1, "默认图片"),
|
||||||
|
UPLOAD(2, "上传图片"),
|
||||||
|
NOT_DISPLAY(3, "不显示图片");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类型
|
||||||
|
*/
|
||||||
|
private final Integer type;
|
||||||
|
/**
|
||||||
|
* 说明
|
||||||
|
*/
|
||||||
|
private final String msg;
|
||||||
|
}
|
@ -0,0 +1,25 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.enums.robot.information;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆分页-车辆状态
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum RobotStatisticsTypeEnum {
|
||||||
|
|
||||||
|
STANDBY("standby","待命"),
|
||||||
|
INTASK("inTask","任务中"),
|
||||||
|
DOLOCK("doLock","锁定"),
|
||||||
|
OFFLINE("offline","离线"),
|
||||||
|
CHARGE("charge","充电中"),
|
||||||
|
FAULT("fault","故障");
|
||||||
|
/**
|
||||||
|
* 类型
|
||||||
|
*/
|
||||||
|
private final String type;
|
||||||
|
private final String msg;
|
||||||
|
|
||||||
|
}
|
@ -64,5 +64,5 @@ public interface HouseAreaService {
|
|||||||
* 获得全部库区
|
* 获得全部库区
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<HouseAreaDO> getHouseAreaList();
|
List<HouseAreaDO> getHouseAreaList(Long positionMapId);
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,6 @@ import cn.iocoder.yudao.module.system.controller.admin.positionmap.dto.PositionM
|
|||||||
import cn.iocoder.yudao.module.system.dal.dataobject.housearea.HouseAreaDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.housearea.HouseAreaDO;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.houselocation.WareHouseLocationDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.houselocation.WareHouseLocationDO;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.positionmap.PositionMapItemDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.positionmap.PositionMapItemDO;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotModelDO;
|
|
||||||
import cn.iocoder.yudao.module.system.dal.mysql.housearea.HouseAreaMapper;
|
import cn.iocoder.yudao.module.system.dal.mysql.housearea.HouseAreaMapper;
|
||||||
import cn.iocoder.yudao.module.system.service.houselocation.HouseLocationService;
|
import cn.iocoder.yudao.module.system.service.houselocation.HouseLocationService;
|
||||||
import cn.iocoder.yudao.module.system.service.positionmap.PositionMapItemService;
|
import cn.iocoder.yudao.module.system.service.positionmap.PositionMapItemService;
|
||||||
@ -157,10 +156,10 @@ public class HouseAreaServiceImpl implements HouseAreaService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<HouseAreaDO> getHouseAreaList() {
|
public List<HouseAreaDO> getHouseAreaList(Long positionMapId) {
|
||||||
List<HouseAreaDO> list = houseAreaMapper.selectList(new LambdaQueryWrapper<HouseAreaDO>()
|
return houseAreaMapper.selectList(new LambdaQueryWrapper<HouseAreaDO>()
|
||||||
|
.eq(HouseAreaDO::getPositionMapId, positionMapId)
|
||||||
.orderByAsc(HouseAreaDO::getId));
|
.orderByAsc(HouseAreaDO::getId));
|
||||||
return list;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.system.service.information;
|
|||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.information.dto.DeviceInformationDTO;
|
import cn.iocoder.yudao.module.system.controller.admin.information.dto.DeviceInformationDTO;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.information.dto.MapBindDeviceInfoDTO;
|
import cn.iocoder.yudao.module.system.controller.admin.information.dto.MapBindDeviceInfoDTO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.information.dto.StatisticsInformationDTO;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.information.vo.DeviceInformationPageReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.information.vo.DeviceInformationPageReqVO;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.information.vo.DeviceInformationSaveReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.information.vo.DeviceInformationSaveReqVO;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.information.DeviceInformationDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.information.DeviceInformationDO;
|
||||||
@ -92,4 +93,17 @@ public interface DeviceInformationService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Map<Integer, List<DeviceInformationDO>> classification();
|
Map<Integer, List<DeviceInformationDO>> classification();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 统计设备
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<StatisticsInformationDTO> getDeviceNumber();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查看全部设备
|
||||||
|
* @param pageReqVO
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<DeviceInformationDO> getInformationList(@Valid DeviceInformationPageReqVO pageReqVO);
|
||||||
}
|
}
|
||||||
|
@ -8,11 +8,16 @@ import cn.iocoder.yudao.module.grpc.api.GrpcServiceApi;
|
|||||||
import cn.iocoder.yudao.module.system.constant.device.DeviceChcheConstant;
|
import cn.iocoder.yudao.module.system.constant.device.DeviceChcheConstant;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.information.dto.DeviceInformationDTO;
|
import cn.iocoder.yudao.module.system.controller.admin.information.dto.DeviceInformationDTO;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.information.dto.MapBindDeviceInfoDTO;
|
import cn.iocoder.yudao.module.system.controller.admin.information.dto.MapBindDeviceInfoDTO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.information.dto.StatisticsInformationDTO;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.information.vo.DeviceInformationPageReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.information.vo.DeviceInformationPageReqVO;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.information.vo.DeviceInformationSaveReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.information.vo.DeviceInformationSaveReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.dict.DictDataDO;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.information.DeviceInformationDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.information.DeviceInformationDO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.mysql.config.CommonConfigMapper;
|
||||||
import cn.iocoder.yudao.module.system.dal.mysql.information.DeviceInformationMapper;
|
import cn.iocoder.yudao.module.system.dal.mysql.information.DeviceInformationMapper;
|
||||||
import cn.iocoder.yudao.module.system.enums.device.DeviceStatusEnum;
|
import cn.iocoder.yudao.module.system.enums.device.DeviceStatusEnum;
|
||||||
|
import cn.iocoder.yudao.module.system.enums.device.PictureConfigEnum;
|
||||||
|
import cn.iocoder.yudao.module.system.service.dict.DictDataService;
|
||||||
import cn.iocoder.yudao.module.system.util.redis.RedisUtil;
|
import cn.iocoder.yudao.module.system.util.redis.RedisUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@ -45,6 +50,9 @@ public class DeviceInformationServiceImpl implements DeviceInformationService {
|
|||||||
@Resource
|
@Resource
|
||||||
private DeviceInformationMapper informationMapper;
|
private DeviceInformationMapper informationMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private DictDataService dictDataService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private GrpcServiceApi grpcServiceApi;
|
private GrpcServiceApi grpcServiceApi;
|
||||||
|
|
||||||
@ -59,6 +67,17 @@ public class DeviceInformationServiceImpl implements DeviceInformationService {
|
|||||||
if (ObjectUtil.isNotEmpty(pageResult.getList())) {
|
if (ObjectUtil.isNotEmpty(pageResult.getList())) {
|
||||||
throw exception(INFORMATION_MAC_EXIST);
|
throw exception(INFORMATION_MAC_EXIST);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//默认图片
|
||||||
|
if (PictureConfigEnum.DEFAULT.getType().equals(createReqVO.getPictureConfig())) {
|
||||||
|
List<DictDataDO> deviceType = dictDataService.getDictDataListByDictType("device_type");
|
||||||
|
DictDataDO dictDataDO = deviceType.stream()
|
||||||
|
.filter(v -> Integer.valueOf(v.getValue()).equals(createReqVO.getDeviceType()))
|
||||||
|
.findFirst()
|
||||||
|
.orElse(new DictDataDO());
|
||||||
|
createReqVO.setUrl(dictDataDO.getRemark());
|
||||||
|
}
|
||||||
|
|
||||||
// 插入
|
// 插入
|
||||||
DeviceInformationDO information = BeanUtils.toBean(createReqVO, DeviceInformationDO.class);
|
DeviceInformationDO information = BeanUtils.toBean(createReqVO, DeviceInformationDO.class);
|
||||||
information.setDeviceStatus(1);
|
information.setDeviceStatus(1);
|
||||||
@ -191,6 +210,67 @@ public class DeviceInformationServiceImpl implements DeviceInformationService {
|
|||||||
|
|
||||||
return collect;
|
return collect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 统计设备
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<StatisticsInformationDTO> getDeviceNumber() {
|
||||||
|
List<DeviceInformationDO> deviceInformationDOS = informationMapper.selectList(new LambdaQueryWrapper<DeviceInformationDO>());
|
||||||
|
if (ObjectUtil.isEmpty(deviceInformationDOS)) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
List<StatisticsInformationDTO> list = deviceInformationDOS.stream()
|
||||||
|
.filter(v -> ObjectUtil.isNotEmpty(v.getDeviceType()))
|
||||||
|
.collect(Collectors.groupingBy(DeviceInformationDO::getDeviceType))
|
||||||
|
.entrySet().stream()
|
||||||
|
.map(v -> {
|
||||||
|
Integer key = v.getKey();
|
||||||
|
int number = v.getValue().size();
|
||||||
|
StatisticsInformationDTO statisticsInformationDTO = new StatisticsInformationDTO();
|
||||||
|
statisticsInformationDTO.setDeviceType(key);
|
||||||
|
statisticsInformationDTO.setNumber(number);
|
||||||
|
return statisticsInformationDTO;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DeviceInformationDO> getInformationList(DeviceInformationPageReqVO dto) {
|
||||||
|
|
||||||
|
List<DeviceInformationDO> deviceInformationDOS = informationMapper.selectList(new LambdaQueryWrapper<DeviceInformationDO>()
|
||||||
|
.like(dto.getDeviceNo() != null, DeviceInformationDO::getDeviceNo, dto.getDeviceNo())
|
||||||
|
.eq(dto.getDeviceType() != null, DeviceInformationDO::getDeviceType, dto.getDeviceType())
|
||||||
|
);
|
||||||
|
|
||||||
|
if (ObjectUtil.isEmpty(deviceInformationDOS)) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
// todo 需要设置设备通讯的时间
|
||||||
|
for (DeviceInformationDO deviceInformationDO : deviceInformationDOS) {
|
||||||
|
String deviceKey = DeviceChcheConstant.DEVICE_LAST_TIME +deviceInformationDO.getMacAddress();
|
||||||
|
Object object = redisUtil.get(deviceKey);
|
||||||
|
if (ObjectUtil.isEmpty(object)) {
|
||||||
|
deviceInformationDO.setDeviceStatus(DeviceStatusEnum.OFF_LINE.getType());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||||
|
LocalDateTime curTimeLDT = LocalDateTime.parse((String)object, df);
|
||||||
|
deviceInformationDO.setDeviceLastTime(curTimeLDT);
|
||||||
|
deviceInformationDO.setDeviceStatus(DeviceStatusEnum.ON_LINE.getType());
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.info("查询设备最后通讯时间异常 :{}",e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return deviceInformationDOS;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mapBindDeviceInfo(MapBindDeviceInfoDTO dto) {
|
public void mapBindDeviceInfo(MapBindDeviceInfoDTO dto) {
|
||||||
DeviceInformationDO deviceInformationDO = informationMapper.selectById(dto.getDeviceInfoId());
|
DeviceInformationDO deviceInformationDO = informationMapper.selectById(dto.getDeviceInfoId());
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.service.path;
|
||||||
|
|
||||||
|
public interface PathPlanningService {
|
||||||
|
void synchronousPoint();
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.service.path;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 同步信息给车辆
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
public class PathPlanningServiceImpl implements PathPlanningService {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 同步全部的点位信息
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void synchronousPoint() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -1,12 +1,12 @@
|
|||||||
package cn.iocoder.yudao.module.system.service.robot;
|
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.PageResult;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.robot.vo.*;
|
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.dal.dataobject.robot.RobotInformationDO;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 车辆信息 Service 接口
|
* 车辆信息 Service 接口
|
||||||
*
|
*
|
||||||
@ -54,27 +54,30 @@ public interface RobotInformationService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 统计车辆待命/任务中/离线
|
* 统计车辆待命/任务中/离线
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
RobotInformationStatisticsVO statisticsInformation();
|
RobotInformationStatisticsVO statisticsInformation();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询能正常使用的车辆
|
* 查询能正常使用的车辆
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<RobotInformationDO> getCanUseRobot();
|
List<RobotInformationDO> getCanUseRobot();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询所有车辆
|
* 查询所有车辆
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<RobotInformationDO> getAllRobot();
|
List<RobotInformationDO> getAllRobot();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询机器人编号
|
* 查询机器人编号
|
||||||
|
*
|
||||||
* @param mac
|
* @param mac
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
String getRobotNoByMac(String mac);
|
String getRobotNoByMac(String mac);
|
||||||
|
|
||||||
}
|
}
|
@ -3,6 +3,8 @@ package cn.iocoder.yudao.module.system.service.robot;
|
|||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.json.JSONUtil;
|
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.module.system.api.robot.dto.RobotStatusDataPoseDTO;
|
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.constant.robot.RobotTaskChcheConstant;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.robot.vo.*;
|
import cn.iocoder.yudao.module.system.controller.admin.robot.vo.*;
|
||||||
@ -15,16 +17,16 @@ import cn.iocoder.yudao.module.system.dal.mysql.robot.RobotInformationMapper;
|
|||||||
import cn.iocoder.yudao.module.system.dal.mysql.robot.RobotModelMapper;
|
import cn.iocoder.yudao.module.system.dal.mysql.robot.RobotModelMapper;
|
||||||
import cn.iocoder.yudao.module.system.dal.mysql.robot.RobotTaskDetailMapper;
|
import cn.iocoder.yudao.module.system.dal.mysql.robot.RobotTaskDetailMapper;
|
||||||
import cn.iocoder.yudao.module.system.enums.robot.*;
|
import cn.iocoder.yudao.module.system.enums.robot.*;
|
||||||
|
import cn.iocoder.yudao.module.system.enums.robot.information.RobotStatisticsTypeEnum;
|
||||||
import cn.iocoder.yudao.module.system.util.redis.RedisUtil;
|
import cn.iocoder.yudao.module.system.util.redis.RedisUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import javax.annotation.Resource;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
import java.util.*;
|
import javax.annotation.Resource;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import java.util.ArrayList;
|
||||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
|
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
|
||||||
@ -105,7 +107,7 @@ public class RobotInformationServiceImpl implements RobotInformationService {
|
|||||||
// 更新
|
// 更新
|
||||||
RobotInformationDO updateObj = BeanUtils.toBean(updateReqVO, RobotInformationDO.class);
|
RobotInformationDO updateObj = BeanUtils.toBean(updateReqVO, RobotInformationDO.class);
|
||||||
informationMapper.updateById(updateObj);
|
informationMapper.updateById(updateObj);
|
||||||
redisUtil.set(RobotTaskChcheConstant.ROBOT_GET_ROBOTNO_BY_MAC + updateObj.getMacAddress(),updateObj.getRobotNo());
|
redisUtil.set(RobotTaskChcheConstant.ROBOT_GET_ROBOTNO_BY_MAC + updateObj.getMacAddress(), updateObj.getRobotNo());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -150,65 +152,108 @@ public class RobotInformationServiceImpl implements RobotInformationService {
|
|||||||
targetList.stream().forEach(v -> {
|
targetList.stream().forEach(v -> {
|
||||||
setMsgAndRobotStatus(v);
|
setMsgAndRobotStatus(v);
|
||||||
});
|
});
|
||||||
dataPage.setList(targetList);
|
|
||||||
|
if (ObjectUtil.isNotEmpty(pageReqVO.getRobotStatisticsType())) {
|
||||||
|
List<RobotInformationPageRespVO> resultList = new ArrayList<>();
|
||||||
|
for (RobotInformationPageRespVO v : targetList) {
|
||||||
|
if (RobotStatisticsTypeEnum.STANDBY.getType().equals(pageReqVO.getRobotStatisticsType())
|
||||||
|
&& v.getRobotTaskStatus().equals(0)) {
|
||||||
|
resultList.add(v);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (RobotStatisticsTypeEnum.INTASK.getType().equals(pageReqVO.getRobotStatisticsType())
|
||||||
|
&& v.getRobotTaskStatus().equals(1)) {
|
||||||
|
resultList.add(v);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (RobotStatisticsTypeEnum.CHARGE.getType().equals(pageReqVO.getRobotStatisticsType())
|
||||||
|
&& v.getRobotTaskStatus().equals(2)) {
|
||||||
|
resultList.add(v);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (RobotStatisticsTypeEnum.DOLOCK.getType().equals(pageReqVO.getRobotStatisticsType())
|
||||||
|
&& v.getRobotEssenceStatus().equals(1)) {
|
||||||
|
resultList.add(v);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (RobotStatisticsTypeEnum.OFFLINE.getType().equals(pageReqVO.getRobotStatisticsType())
|
||||||
|
&& v.getOnlineStatus().equals(1)) {
|
||||||
|
resultList.add(v);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (RobotStatisticsTypeEnum.FAULT.getType().equals(pageReqVO.getRobotStatisticsType())
|
||||||
|
&& v.getRobotEssenceStatus().equals(2)) {
|
||||||
|
resultList.add(v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dataPage.setList(resultList);
|
||||||
|
} else {
|
||||||
|
dataPage.setList(targetList);
|
||||||
|
}
|
||||||
|
|
||||||
return dataPage;
|
return dataPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置状态和信息
|
* 设置状态和信息
|
||||||
|
*
|
||||||
* @param v
|
* @param v
|
||||||
*/
|
*/
|
||||||
private void setMsgAndRobotStatus(RobotInformationPageRespVO v) {
|
private void setMsgAndRobotStatus(RobotInformationPageRespVO v) {
|
||||||
String pose2dKey = RobotTaskChcheConstant.ROBOT_INFORMATION_POSE_BAT_SOC +v.getMacAddress();
|
String pose2dKey = RobotTaskChcheConstant.ROBOT_INFORMATION_POSE_BAT_SOC + v.getMacAddress();
|
||||||
Object object = redisUtil.get(pose2dKey);
|
Object object = redisUtil.get(pose2dKey);
|
||||||
RobotStatusDataPoseDTO robotStatusDataPoseDTO= JSONUtil.toBean((String)object, RobotStatusDataPoseDTO.class);
|
RobotStatusDataPoseDTO robotStatusDataPoseDTO = JSONUtil.toBean((String) object, RobotStatusDataPoseDTO.class);
|
||||||
|
|
||||||
String robotDoingActionKey = RobotTaskChcheConstant.ROBOT_QUERY_DOING_ACTION +v.getMacAddress();
|
String robotDoingActionKey = RobotTaskChcheConstant.ROBOT_QUERY_DOING_ACTION + v.getMacAddress();
|
||||||
Object action = redisUtil.get(robotDoingActionKey);
|
Object action = redisUtil.get(robotDoingActionKey);
|
||||||
|
|
||||||
if (ObjectUtil.isNotEmpty(object) && ObjectUtil.isNotEmpty(robotStatusDataPoseDTO)) {
|
if (ObjectUtil.isNotEmpty(object) && ObjectUtil.isNotEmpty(robotStatusDataPoseDTO)) {
|
||||||
v.setElectricity(robotStatusDataPoseDTO.getBat_soc());
|
v.setElectricity(robotStatusDataPoseDTO.getBat_soc());
|
||||||
v.setFloor(robotStatusDataPoseDTO.getFloor());
|
v.setFloor(robotStatusDataPoseDTO.getFloor());
|
||||||
v.setArea(robotStatusDataPoseDTO.getArea());
|
v.setArea(robotStatusDataPoseDTO.getArea());
|
||||||
|
} else if (ObjectUtil.isEmpty(object)) {
|
||||||
|
//离线
|
||||||
|
v.setOnlineStatus(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RobotTaskModelEnum.REJECTION.getType().equals(v.getRobotTaskModel())) {
|
v.setRobotEssenceStatus(v.getRobotTaskModel());
|
||||||
v.setRobotStatus(RobotInformationPageStatusEnum.DOLOCK.getType());
|
//设置异常
|
||||||
v.setMsg("车辆已经锁定");
|
String errorLevelKey = RobotTaskChcheConstant.ROBOT_ERROR_LEVEL + v.getMacAddress();
|
||||||
}else if (ObjectUtil.isEmpty(object)) {
|
Object errorLevel = redisUtil.get(errorLevelKey);
|
||||||
v.setRobotStatus(RobotInformationPageStatusEnum.OFFLINE.getType());
|
if (ObjectUtil.isNotEmpty(errorLevel) && Integer.valueOf(errorLevel.toString()).intValue() >= 3) {
|
||||||
v.setMsg("车辆已经离线");
|
v.setRobotEssenceStatus(2);
|
||||||
}else if (RobotStatusEnum.STAND_BY.getType().equals(v.getRobotStatus())) {
|
}
|
||||||
//查看机器人最后做的任务是不是充电
|
|
||||||
RobotTaskDetailDO robotTaskDetailDO = taskDetailMapper.selectOne(new LambdaQueryWrapper<RobotTaskDetailDO>()
|
if (RobotStatusEnum.STAND_BY.getType().equals(v.getRobotStatus())) {
|
||||||
.eq(RobotTaskDetailDO::getRobotNo, v.getRobotNo())
|
//待命中
|
||||||
.orderByDesc(RobotTaskDetailDO::getCreateTime)
|
v.setRobotTaskStatus(0);
|
||||||
.last("limit 1"));
|
v.setMsg("车辆正在待命中");
|
||||||
if (ObjectUtil.isNotEmpty(robotTaskDetailDO)
|
} else if (RobotStatusEnum.CHARGE.getType().equals(v.getRobotStatus())) {
|
||||||
&& RobotTaskTypeEnum.CHARGE.getType().equals(robotTaskDetailDO.getTaskType())
|
//充电中
|
||||||
&& RobotTaskStatusEnum.DOING.getType().equals(robotTaskDetailDO.getTaskStatus())) {
|
v.setRobotTaskStatus(2);
|
||||||
v.setRobotStatus(RobotInformationPageStatusEnum.CHARGE.getType());
|
v.setMsg("车辆正在充电");
|
||||||
v.setMsg("车辆正在充电");
|
|
||||||
}else {
|
|
||||||
v.setRobotStatus(RobotInformationPageStatusEnum.STANDBY.getType());
|
|
||||||
v.setMsg("车辆正在待命");
|
|
||||||
}
|
|
||||||
}else if (RobotStatusEnum.DOING.getType().equals(v.getRobotStatus()) && ObjectUtil.isNotEmpty(action)) {
|
|
||||||
v.setRobotStatus(RobotInformationPageStatusEnum.INTASK.getType());
|
|
||||||
CommandTypeEnum commandType = CommandTypeEnum.getCommandType(String.valueOf(action));
|
|
||||||
if (ObjectUtil.isNotEmpty(commandType)) {
|
|
||||||
v.setMsg("车辆正在"+commandType.getMsg());
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
v.setRobotStatus(RobotInformationPageStatusEnum.FAULT.getType());
|
//任务中
|
||||||
v.setMsg("车辆发生异常");
|
v.setRobotTaskStatus(1);
|
||||||
|
if (RobotStatusEnum.DOING.getType().equals(v.getRobotStatus()) && ObjectUtil.isNotEmpty(action)) {
|
||||||
|
v.setRobotStatus(1);
|
||||||
|
CommandTypeEnum commandType = CommandTypeEnum.getCommandType(String.valueOf(action));
|
||||||
|
if (ObjectUtil.isNotEmpty(commandType)) {
|
||||||
|
v.setMsg("车辆正在" + commandType.getMsg());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 统计车辆待命/任务中/离线
|
* 统计车辆待命/任务中/离线
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@ -228,13 +273,13 @@ public class RobotInformationServiceImpl implements RobotInformationService {
|
|||||||
Integer fault = 0;
|
Integer fault = 0;
|
||||||
//0:待命、1:任务中、2:锁定、3:离线、4:充电中、5:故障
|
//0:待命、1:任务中、2:锁定、3:离线、4:充电中、5:故障
|
||||||
for (RobotInformationDO v : existRobot) {
|
for (RobotInformationDO v : existRobot) {
|
||||||
String pose2dKey = RobotTaskChcheConstant.ROBOT_INFORMATION_POSE_BAT_SOC +v.getMacAddress();
|
String pose2dKey = RobotTaskChcheConstant.ROBOT_INFORMATION_POSE_BAT_SOC + v.getMacAddress();
|
||||||
Object object = redisUtil.get(pose2dKey);
|
Object object = redisUtil.get(pose2dKey);
|
||||||
if (ObjectUtil.isEmpty(object)) {
|
if (ObjectUtil.isEmpty(object)) {
|
||||||
offline++;
|
offline++;
|
||||||
}else if (RobotTaskModelEnum.REJECTION.getType().equals(v.getRobotTaskModel())) {
|
} else if (RobotTaskModelEnum.REJECTION.getType().equals(v.getRobotTaskModel())) {
|
||||||
doLock++;
|
doLock++;
|
||||||
}else if (RobotStatusEnum.STAND_BY.getType().equals(v.getRobotStatus())) {
|
} else if (RobotStatusEnum.STAND_BY.getType().equals(v.getRobotStatus())) {
|
||||||
|
|
||||||
//查看机器人最后做的任务是不是充电
|
//查看机器人最后做的任务是不是充电
|
||||||
RobotTaskDetailDO robotTaskDetailDO = taskDetailMapper.selectOne(new LambdaQueryWrapper<RobotTaskDetailDO>()
|
RobotTaskDetailDO robotTaskDetailDO = taskDetailMapper.selectOne(new LambdaQueryWrapper<RobotTaskDetailDO>()
|
||||||
@ -245,11 +290,11 @@ public class RobotInformationServiceImpl implements RobotInformationService {
|
|||||||
&& RobotTaskTypeEnum.CHARGE.getType().equals(robotTaskDetailDO.getTaskType())
|
&& RobotTaskTypeEnum.CHARGE.getType().equals(robotTaskDetailDO.getTaskType())
|
||||||
&& RobotTaskStatusEnum.DOING.getType().equals(robotTaskDetailDO.getTaskStatus())) {
|
&& RobotTaskStatusEnum.DOING.getType().equals(robotTaskDetailDO.getTaskStatus())) {
|
||||||
charge++;
|
charge++;
|
||||||
}else {
|
} else {
|
||||||
standby++;
|
standby++;
|
||||||
}
|
}
|
||||||
|
|
||||||
}else if (RobotStatusEnum.DOING.getType().equals(v.getRobotStatus())) {
|
} else if (RobotStatusEnum.DOING.getType().equals(v.getRobotStatus())) {
|
||||||
inTask++;
|
inTask++;
|
||||||
} else {
|
} else {
|
||||||
fault++;
|
fault++;
|
||||||
@ -266,7 +311,6 @@ public class RobotInformationServiceImpl implements RobotInformationService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@ -284,6 +328,7 @@ public class RobotInformationServiceImpl implements RobotInformationService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据mac查询机器人编号
|
* 根据mac查询机器人编号
|
||||||
|
*
|
||||||
* @param mac
|
* @param mac
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -302,7 +347,7 @@ public class RobotInformationServiceImpl implements RobotInformationService {
|
|||||||
.eq(RobotInformationDO::getMacAddress, mac)
|
.eq(RobotInformationDO::getMacAddress, mac)
|
||||||
.last("limit 1"));
|
.last("limit 1"));
|
||||||
if (ObjectUtil.isNotEmpty(robotInformationDO)) {
|
if (ObjectUtil.isNotEmpty(robotInformationDO)) {
|
||||||
redisUtil.set(RobotTaskChcheConstant.ROBOT_GET_ROBOTNO_BY_MAC + mac,robotInformationDO.getRobotNo());
|
redisUtil.set(RobotTaskChcheConstant.ROBOT_GET_ROBOTNO_BY_MAC + mac, robotInformationDO.getRobotNo());
|
||||||
return robotInformationDO.getRobotNo();
|
return robotInformationDO.getRobotNo();
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
|
@ -76,7 +76,7 @@ public class AutoChargeServiceImpl implements AutoChargeService {
|
|||||||
public void autoChargeJob() {
|
public void autoChargeJob() {
|
||||||
TenantContextHolder.setTenantId(1L);
|
TenantContextHolder.setTenantId(1L);
|
||||||
CommonConfigDO commonConfigDO = configMapper.selectOne(new LambdaQueryWrapper<CommonConfigDO>()
|
CommonConfigDO commonConfigDO = configMapper.selectOne(new LambdaQueryWrapper<CommonConfigDO>()
|
||||||
.eq(CommonConfigDO::getConfigType, CommandConfigTypeEnum.ONE.getType()));
|
.eq(CommonConfigDO::getConfigType, CommandConfigTypeEnum.CHARG_CONFIG.getType()));
|
||||||
|
|
||||||
if (ObjectUtil.isEmpty(commonConfigDO)) {
|
if (ObjectUtil.isEmpty(commonConfigDO)) {
|
||||||
log.info("暂未配置充电信息");
|
log.info("暂未配置充电信息");
|
||||||
|
@ -127,7 +127,7 @@ public class DistributeTasksServiceImpl implements DistributeTasksService {
|
|||||||
Pair<List<RobotInformationDO>, List<RobotTaskDetailDO>> pair = Pair.of(new ArrayList<>(), new ArrayList<>());
|
Pair<List<RobotInformationDO>, List<RobotTaskDetailDO>> pair = Pair.of(new ArrayList<>(), new ArrayList<>());
|
||||||
|
|
||||||
CommonConfigDO commonConfigDO = configMapper.selectOne(new LambdaQueryWrapper<CommonConfigDO>()
|
CommonConfigDO commonConfigDO = configMapper.selectOne(new LambdaQueryWrapper<CommonConfigDO>()
|
||||||
.eq(CommonConfigDO::getConfigType, CommandConfigTypeEnum.ONE.getType()));
|
.eq(CommonConfigDO::getConfigType, CommandConfigTypeEnum.CHARG_CONFIG.getType()));
|
||||||
CommonConfigVO chargeConfig= JSONUtil.toBean(commonConfigDO.getConfigStr(),CommonConfigVO.class);
|
CommonConfigVO chargeConfig= JSONUtil.toBean(commonConfigDO.getConfigStr(),CommonConfigVO.class);
|
||||||
LocalDateTime now = LocalDateTime.now();
|
LocalDateTime now = LocalDateTime.now();
|
||||||
if ((ObjectUtil.isNotEmpty(chargeConfig.getScheduleChargeEndTime()) &&
|
if ((ObjectUtil.isNotEmpty(chargeConfig.getScheduleChargeEndTime()) &&
|
||||||
|
@ -58,7 +58,7 @@ spring:
|
|||||||
primary: master
|
primary: master
|
||||||
datasource:
|
datasource:
|
||||||
master:
|
master:
|
||||||
url: jdbc:mysql://47.97.8.94:3306/zn_wcs?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true&rewriteBatchedStatements=true # MySQL Connector/J 8.X 连接的示例
|
url: jdbc:mysql://47.97.8.94:3306/zn_wcs?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true&rewriteBatchedStatements=true&allowMultiQueries=true # MySQL Connector/J 8.X 连接的示例
|
||||||
# url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=true&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true # MySQL Connector/J 5.X 连接的示例
|
# url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=true&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true # MySQL Connector/J 5.X 连接的示例
|
||||||
# url: jdbc:postgresql://127.0.0.1:5432/ruoyi-vue-pro # PostgreSQL 连接的示例
|
# url: jdbc:postgresql://127.0.0.1:5432/ruoyi-vue-pro # PostgreSQL 连接的示例
|
||||||
# url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例
|
# url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例
|
||||||
@ -72,7 +72,7 @@ spring:
|
|||||||
# password: SYSDBA # DM 连接的示例
|
# password: SYSDBA # DM 连接的示例
|
||||||
slave: # 模拟从库,可根据自己需要修改
|
slave: # 模拟从库,可根据自己需要修改
|
||||||
lazy: true # 开启懒加载,保证启动速度
|
lazy: true # 开启懒加载,保证启动速度
|
||||||
url: jdbc:mysql://47.97.8.94:3306/zn_wcs?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true&rewriteBatchedStatements=true
|
url: jdbc:mysql://47.97.8.94:3306/zn_wcs?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true&rewriteBatchedStatements=true&allowMultiQueries=true
|
||||||
username: root
|
username: root
|
||||||
password: yhtkj@2024!
|
password: yhtkj@2024!
|
||||||
|
|
||||||
@ -227,6 +227,7 @@ zn:
|
|||||||
lift_height: 0.1 #抬高托盘高度
|
lift_height: 0.1 #抬高托盘高度
|
||||||
move_height: 0.1 #行走高度
|
move_height: 0.1 #行走高度
|
||||||
lane_auto_move: true #线库是否自动移库 true:线库执行自动移库 、false:线库关闭执行自动移库
|
lane_auto_move: true #线库是否自动移库 true:线库执行自动移库 、false:线库关闭执行自动移库
|
||||||
robot_position_cache_time: 10 #机器人上报点位存储时间
|
robot_position_cache_time: 10 #机器人上报点位存储时间(秒)
|
||||||
cycle_do_auto_move: true #存在循环的任务,是否开启自动移库. true:存在循环任务,开启自动移库; false:有循环任务不自动移库
|
cycle_do_auto_move: true #存在循环的任务,是否开启自动移库. true:存在循环任务,开启自动移库; false:有循环任务不自动移库
|
||||||
full_electricity: 100 #机器人充满电的电量
|
full_electricity: 100 #机器人充满电的电量
|
||||||
|
robot_error_level_time: 30 #机器人异常存储时间(秒)
|
||||||
|
Loading…
Reference in New Issue
Block a user