远遥车速
This commit is contained in:
parent
97fa291198
commit
feaa3a76c6
@ -0,0 +1,16 @@
|
||||
package cn.iocoder.yudao.module.mqtt.api.path.dto.remote;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.bouncycastle.cms.PasswordRecipientId;
|
||||
|
||||
@Data
|
||||
public class RobotModeDTO {
|
||||
|
||||
private String commandType;
|
||||
|
||||
@Schema(description = "AUTO自动、 MAN手动")
|
||||
private String operationMode;
|
||||
|
||||
private Double maxSpeed;
|
||||
}
|
@ -71,7 +71,7 @@ public class RemoteRobotController {
|
||||
}
|
||||
|
||||
@PostMapping("/robotChangeMode")
|
||||
@Operation(summary = "获取机器人远遥模式/急停/协控状态")
|
||||
@Operation(summary = "修改模式")
|
||||
@PreAuthorize("@ss.hasPermission('remote:robot:robotChangeMode')")
|
||||
public CommonResult<Boolean> robotChangeMode(@Valid @RequestBody RemoteRobotChangeModeDTO data,HttpServletRequest request) {
|
||||
remoteRobotService.robotChangeMode(data,request);
|
||||
|
@ -0,0 +1,44 @@
|
||||
package cn.iocoder.yudao.module.remote.controller.admin.speed;
|
||||
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.remote.service.speed.RemoteRobotMaxSpeedService;
|
||||
import cn.iocoder.yudao.module.system.api.remote.dto.RemoteRobotMaxSpeedDTO;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "管理后台 - 远遥车辆速度")
|
||||
@RestController
|
||||
@RequestMapping("/remote/robotMaxSpeed")
|
||||
@Validated
|
||||
public class RemoteRobotMaxSpeedController {
|
||||
|
||||
@Autowired
|
||||
private RemoteRobotMaxSpeedService remoteRobotMaxSpeedService;
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "获得远遥车辆最大速度集合")
|
||||
@PreAuthorize("@ss.hasPermission('remote:robotMaxSpeed:list')")
|
||||
public CommonResult<List<RemoteRobotMaxSpeedDTO>> getRobotMaxSpeedPage() {
|
||||
List<RemoteRobotMaxSpeedDTO> list = remoteRobotMaxSpeedService.getRobotMaxSpeedPage();
|
||||
return success(list);
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
@Operation(summary = "获得远遥车辆最大速度集合")
|
||||
@PreAuthorize("@ss.hasPermission('remote:robotMaxSpeed:update')")
|
||||
public CommonResult<Boolean> updateRobotMaxSpeedPage(@RequestBody List<RemoteRobotMaxSpeedDTO> list) {
|
||||
remoteRobotMaxSpeedService.updateRobotMaxSpeedPage(list);
|
||||
return success(true);
|
||||
}
|
||||
}
|
@ -3,10 +3,11 @@ package cn.iocoder.yudao.module.remote.framework.system;
|
||||
import cn.iocoder.yudao.module.system.api.remote.RemoteExceptionTaskApi;
|
||||
import cn.iocoder.yudao.module.system.api.remote.RemoteLoginApi;
|
||||
import cn.iocoder.yudao.module.system.api.remote.RemoteRobotApi;
|
||||
import cn.iocoder.yudao.module.system.api.remote.RemoteRobotMaxSpeedApi;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@EnableFeignClients(clients = {RemoteLoginApi.class, RemoteRobotApi.class, RemoteExceptionTaskApi.class})
|
||||
@EnableFeignClients(clients = {RemoteLoginApi.class, RemoteRobotApi.class, RemoteExceptionTaskApi.class, RemoteRobotMaxSpeedApi.class})
|
||||
public class SystemConfiguration {
|
||||
}
|
||||
|
@ -0,0 +1,11 @@
|
||||
package cn.iocoder.yudao.module.remote.service.speed;
|
||||
|
||||
import cn.iocoder.yudao.module.system.api.remote.dto.RemoteRobotMaxSpeedDTO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface RemoteRobotMaxSpeedService {
|
||||
List<RemoteRobotMaxSpeedDTO> getRobotMaxSpeedPage();
|
||||
|
||||
void updateRobotMaxSpeedPage(List<RemoteRobotMaxSpeedDTO> list);
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package cn.iocoder.yudao.module.remote.service.speed;
|
||||
|
||||
import cn.iocoder.yudao.module.system.api.remote.RemoteRobotMaxSpeedApi;
|
||||
import cn.iocoder.yudao.module.system.api.remote.dto.RemoteRobotMaxSpeedDTO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class RemoteRobotMaxSpeedServiceImpl implements RemoteRobotMaxSpeedService{
|
||||
|
||||
@Resource
|
||||
private RemoteRobotMaxSpeedApi remoteRobotMaxSpeedApi;
|
||||
|
||||
@Override
|
||||
public List<RemoteRobotMaxSpeedDTO> getRobotMaxSpeedPage() {
|
||||
return remoteRobotMaxSpeedApi.getRobotMaxSpeedPage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateRobotMaxSpeedPage(List<RemoteRobotMaxSpeedDTO> list) {
|
||||
remoteRobotMaxSpeedApi.updateRobotMaxSpeedPage(list);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package cn.iocoder.yudao.module.system.api.remote;
|
||||
|
||||
import cn.iocoder.yudao.module.system.api.remote.dto.RemoteRobotMaxSpeedDTO;
|
||||
import cn.iocoder.yudao.module.system.enums.ApiConstants;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory =
|
||||
@Tag(name = "RPC 服务 - 远遥车辆相关速度")
|
||||
public interface RemoteRobotMaxSpeedApi {
|
||||
|
||||
String PREFIX = ApiConstants.PREFIX + "/remote";
|
||||
|
||||
@PostMapping(PREFIX + "/getRobotMaxSpeedPage")
|
||||
@Operation(summary = "获取远遥车辆速度")
|
||||
List<RemoteRobotMaxSpeedDTO> getRobotMaxSpeedPage();
|
||||
|
||||
@PostMapping(PREFIX + "/updateRobotMaxSpeed")
|
||||
@Operation(summary = "更新远遥车辆速度")
|
||||
void updateRobotMaxSpeedPage(@RequestBody List<RemoteRobotMaxSpeedDTO> list);
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package cn.iocoder.yudao.module.system.api.remote.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
@Data
|
||||
public class RemoteRobotMaxSpeedDTO {
|
||||
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "AGV编号")
|
||||
private String robotNo;
|
||||
|
||||
@Schema(description = "远遥最大速度, 最大5米每秒")
|
||||
private String maxSpeed;
|
||||
}
|
@ -292,4 +292,7 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode CAMERA_NOT_EXISTS = new ErrorCode(1_002_054_001, "车辆摄像头信息不存在");
|
||||
ErrorCode CAMERA_IP_EXIST = new ErrorCode(1_002_054_001, "车辆摄像头IP已经存在");
|
||||
ErrorCode CAMERA_IP_REPEAT = new ErrorCode(1_002_054_001, "存在重复的摄像头IP");
|
||||
|
||||
// ========== 远遥车辆最大速度 TODO 补充编号 ==========
|
||||
ErrorCode ROBOT_MAX_SPEED_NOT_EXISTS = new ErrorCode(1_002_054_001, "远遥车辆最大速度不存在");
|
||||
}
|
||||
|
@ -0,0 +1,30 @@
|
||||
package cn.iocoder.yudao.module.system.api.remote;
|
||||
|
||||
import cn.iocoder.yudao.module.system.api.remote.dto.RemoteRobotMaxSpeedDTO;
|
||||
import cn.iocoder.yudao.module.system.service.remote.RobotMaxSpeedService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
||||
@Validated
|
||||
public class RemoteRobotMaxSpeedApiImpl implements RemoteRobotMaxSpeedApi{
|
||||
|
||||
@Resource
|
||||
private RobotMaxSpeedService robotMaxSpeedService;
|
||||
|
||||
@Override
|
||||
public List<RemoteRobotMaxSpeedDTO> getRobotMaxSpeedPage() {
|
||||
return robotMaxSpeedService.getAllRobotMaxSpeedList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateRobotMaxSpeedPage(List<RemoteRobotMaxSpeedDTO> list) {
|
||||
robotMaxSpeedService.updateRobotMaxSpeedList(list);
|
||||
}
|
||||
}
|
@ -0,0 +1,96 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.remote;
|
||||
|
||||
import cn.iocoder.yudao.module.system.controller.admin.remote.vo.RobotMaxSpeedPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.remote.vo.RobotMaxSpeedRespVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.remote.vo.RobotMaxSpeedSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.remote.RobotMaxSpeedDO;
|
||||
import cn.iocoder.yudao.module.system.service.remote.RobotMaxSpeedService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import javax.validation.*;
|
||||
import javax.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
|
||||
@Tag(name = "管理后台 - 远遥车辆最大速度")
|
||||
@RestController
|
||||
@RequestMapping("/system/remote/robot-max-speed")
|
||||
@Validated
|
||||
public class RobotMaxSpeedController {
|
||||
|
||||
@Resource
|
||||
private RobotMaxSpeedService robotMaxSpeedService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建远遥车辆最大速度")
|
||||
@PreAuthorize("@ss.hasPermission('remote:robot-max-speed:create')")
|
||||
public CommonResult<Long> createRobotMaxSpeed(@Valid @RequestBody RobotMaxSpeedSaveReqVO createReqVO) {
|
||||
return success(robotMaxSpeedService.createRobotMaxSpeed(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新远遥车辆最大速度")
|
||||
@PreAuthorize("@ss.hasPermission('remote:robot-max-speed:update')")
|
||||
public CommonResult<Boolean> updateRobotMaxSpeed(@Valid @RequestBody RobotMaxSpeedSaveReqVO updateReqVO) {
|
||||
robotMaxSpeedService.updateRobotMaxSpeed(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除远遥车辆最大速度")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('remote:robot-max-speed:delete')")
|
||||
public CommonResult<Boolean> deleteRobotMaxSpeed(@RequestParam("id") Long id) {
|
||||
robotMaxSpeedService.deleteRobotMaxSpeed(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得远遥车辆最大速度")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('remote:robot-max-speed:query')")
|
||||
public CommonResult<RobotMaxSpeedRespVO> getRobotMaxSpeed(@RequestParam("id") Long id) {
|
||||
RobotMaxSpeedDO robotMaxSpeed = robotMaxSpeedService.getRobotMaxSpeed(id);
|
||||
return success(BeanUtils.toBean(robotMaxSpeed, RobotMaxSpeedRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得远遥车辆最大速度分页")
|
||||
@PreAuthorize("@ss.hasPermission('remote:robot-max-speed:query')")
|
||||
public CommonResult<PageResult<RobotMaxSpeedRespVO>> getRobotMaxSpeedPage(@Valid RobotMaxSpeedPageReqVO pageReqVO) {
|
||||
PageResult<RobotMaxSpeedDO> pageResult = robotMaxSpeedService.getRobotMaxSpeedPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, RobotMaxSpeedRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出远遥车辆最大速度 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('remote:robot-max-speed:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportRobotMaxSpeedExcel(@Valid RobotMaxSpeedPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<RobotMaxSpeedDO> list = robotMaxSpeedService.getRobotMaxSpeedPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "远遥车辆最大速度.xls", "数据", RobotMaxSpeedRespVO.class,
|
||||
BeanUtils.toBean(list, RobotMaxSpeedRespVO.class));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.remote.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 远遥车辆最大速度分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class RobotMaxSpeedPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "AGV编号")
|
||||
private String robotNo;
|
||||
|
||||
@Schema(description = "远遥最大速度")
|
||||
private String maxSpeed;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.remote.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import com.alibaba.excel.annotation.*;
|
||||
|
||||
@Schema(description = "管理后台 - 远遥车辆最大速度 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class RobotMaxSpeedRespVO {
|
||||
|
||||
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "22620")
|
||||
@ExcelProperty("主键ID")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "AGV编号")
|
||||
@ExcelProperty("AGV编号")
|
||||
private String robotNo;
|
||||
|
||||
@Schema(description = "远遥最大速度")
|
||||
@ExcelProperty("远遥最大速度")
|
||||
private String maxSpeed;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.remote.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 远遥车辆最大速度新增/修改 Request VO")
|
||||
@Data
|
||||
public class RobotMaxSpeedSaveReqVO {
|
||||
|
||||
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "22620")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "AGV编号")
|
||||
private String robotNo;
|
||||
|
||||
@Schema(description = "远遥最大速度")
|
||||
private String maxSpeed;
|
||||
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package cn.iocoder.yudao.module.system.dal.dataobject.remote;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
/**
|
||||
* 远遥车辆最大速度 DO
|
||||
*
|
||||
* @author 陈宾顺
|
||||
*/
|
||||
@TableName("remote_robot_max_speed")
|
||||
@KeySequence("remote_robot_max_speed_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class RobotMaxSpeedDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* AGV编号
|
||||
*/
|
||||
private String robotNo;
|
||||
/**
|
||||
* 远遥最大速度
|
||||
*/
|
||||
private String maxSpeed;
|
||||
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package cn.iocoder.yudao.module.system.dal.mysql.remote;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.remote.vo.RobotMaxSpeedPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.remote.RobotMaxSpeedDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 远遥车辆最大速度 Mapper
|
||||
*
|
||||
* @author 陈宾顺
|
||||
*/
|
||||
@Mapper
|
||||
public interface RobotMaxSpeedMapper extends BaseMapperX<RobotMaxSpeedDO> {
|
||||
|
||||
default PageResult<RobotMaxSpeedDO> selectPage(RobotMaxSpeedPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<RobotMaxSpeedDO>()
|
||||
.eqIfPresent(RobotMaxSpeedDO::getRobotNo, reqVO.getRobotNo())
|
||||
.eqIfPresent(RobotMaxSpeedDO::getMaxSpeed, reqVO.getMaxSpeed())
|
||||
.betweenIfPresent(RobotMaxSpeedDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(RobotMaxSpeedDO::getId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新车辆编号
|
||||
* @param oldRobotNo
|
||||
* @param newRobotNo
|
||||
*/
|
||||
void updateRobotNo(@Param("oldRobotNo") String oldRobotNo, @Param("newRobotNo") String newRobotNo);
|
||||
|
||||
/**
|
||||
* 根据车辆编号删除
|
||||
* @param robotNo
|
||||
*/
|
||||
void deleteByRobotNo(@Param("robotNo") String robotNo);
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package cn.iocoder.yudao.module.system.enums.robot.remote;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum RemoteOperationModeEnum {
|
||||
|
||||
AUTO("AUTO","自动控制车辆"),
|
||||
MAN("MAN","手动控制车辆");
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
private final String type;
|
||||
|
||||
private final String msg;
|
||||
|
||||
public static String getType(Integer remoteMode) {
|
||||
if (RemoteModeEnum.AUTOMATIC.getType().equals(remoteMode)) {
|
||||
return AUTO.getType();
|
||||
}
|
||||
return MAN.getType();
|
||||
}
|
||||
}
|
@ -11,6 +11,7 @@ public enum RobotCommandTypeEnum {
|
||||
WORD_PICK_UP_GOODS("WORD_PICK_UP_GOODS","取货"),
|
||||
WORD_DROP_OFF_GOODS("WORD_DROP_OFF_GOODS","放货"),
|
||||
MOVE_POSE("MOVE_POSE","仿真移动点位"),
|
||||
MODE("MODE","远遥/RCS模式切换"),
|
||||
EMERGENCY_STOP("EMERGENCY_STOP","急停车辆"),
|
||||
RECOVERY("RECOVERY","恢复车辆");
|
||||
/**
|
||||
|
@ -5,10 +5,12 @@ import cn.iocoder.yudao.framework.common.util.servlet.ServletUtils;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.mqtt.api.common.CommonApi;
|
||||
import cn.iocoder.yudao.module.mqtt.api.path.dto.remote.RemotePathPlanningDTO;
|
||||
import cn.iocoder.yudao.module.mqtt.api.path.dto.remote.RobotModeDTO;
|
||||
import cn.iocoder.yudao.module.system.api.remote.dto.LoginCheckDTO;
|
||||
import cn.iocoder.yudao.module.system.api.remote.dto.RemoteRobotStatusDTO;
|
||||
import cn.iocoder.yudao.module.system.constant.path.PathPlanningChcheConstant;
|
||||
import cn.iocoder.yudao.module.system.constant.path.PathPlanningTopicConstant;
|
||||
import cn.iocoder.yudao.module.system.constant.robot.RobotTopicConstant;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.log.vo.UserOperationLogSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.remote.vo.RemoteControllerInformationPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.remote.vo.RemoteControllerInformationSaveReqVO;
|
||||
@ -28,12 +30,15 @@ import cn.iocoder.yudao.module.system.enums.robot.RobotStatusEnum;
|
||||
import cn.iocoder.yudao.module.system.enums.robot.RobotTaskModelEnum;
|
||||
import cn.iocoder.yudao.module.system.enums.robot.actionlog.ActionStatusEnum;
|
||||
import cn.iocoder.yudao.module.system.enums.robot.remote.RemoteModeEnum;
|
||||
import cn.iocoder.yudao.module.system.enums.robot.remote.RemoteOperationModeEnum;
|
||||
import cn.iocoder.yudao.module.system.enums.robot.task.RobotCommandTypeEnum;
|
||||
import cn.iocoder.yudao.module.system.service.log.RobotTaskDetailActionLogService;
|
||||
import cn.iocoder.yudao.module.system.service.log.UserOperationLogService;
|
||||
import cn.iocoder.yudao.module.system.service.robot.RobotInformationService;
|
||||
import cn.iocoder.yudao.module.system.service.robot.mapstop.RobotMapStopService;
|
||||
import cn.iocoder.yudao.module.system.util.redis.RedisUtil;
|
||||
import cn.iocoder.yudao.module.system.util.redis.RedissonUtils;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.redisson.api.RLock;
|
||||
@ -92,6 +97,9 @@ public class RemoteControllerInformationServiceImpl extends ServiceImpl<RemoteCo
|
||||
@Resource
|
||||
private CommonConfigMapper configMapper;
|
||||
|
||||
@Resource
|
||||
private RobotMaxSpeedService robotMaxSpeedService;
|
||||
|
||||
@Override
|
||||
public Long createControllerInformation(RemoteControllerInformationSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
@ -282,6 +290,7 @@ public class RemoteControllerInformationServiceImpl extends ServiceImpl<RemoteCo
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void doRobotChangeMode(Integer remoteMode, String remoteIp, String robotNo) {
|
||||
log.info("切换模式的车辆 :{}",robotNo);
|
||||
|
||||
//后续判断下,如果协控中,能不能切换模式
|
||||
|
||||
@ -309,8 +318,8 @@ public class RemoteControllerInformationServiceImpl extends ServiceImpl<RemoteCo
|
||||
if (ObjectUtil.isEmpty(information.getRobotNo()) && RemoteModeEnum.AUTOMATIC.getType().equals(remoteMode)) {
|
||||
String operateAction = information.getRemoteIp() + " 开启远遥为自动模式";
|
||||
setRemoteChangeLog(information, robotNo, remoteMode, operateAction);
|
||||
sendRemoteMsgToRobotAndPP(false,robotNo);
|
||||
//todo 同步苏工和PP 包括车速
|
||||
sendRemoteMsgToRobotAndPP(robotNo);
|
||||
sendModeToRobot(robotNo,RemoteOperationModeEnum.AUTO.getType());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -320,6 +329,8 @@ public class RemoteControllerInformationServiceImpl extends ServiceImpl<RemoteCo
|
||||
.operateAction(information.getRemoteIp() + " 重新进入远遥 " + RemoteModeEnum.getMsg(remoteMode))
|
||||
.nickName(SecurityFrameworkUtils.getLoginUserNickname()).build();
|
||||
userOperationLogService.createUserOperationLog(operationLog);
|
||||
sendRemoteMsgToRobotAndPP(robotNo);
|
||||
sendModeToRobot(robotNo,RemoteOperationModeEnum.getType(remoteMode));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -331,8 +342,8 @@ public class RemoteControllerInformationServiceImpl extends ServiceImpl<RemoteCo
|
||||
}
|
||||
String operateAction = information.getRemoteIp() + " 切换远遥模式为 " + RemoteModeEnum.getMsg(remoteMode);
|
||||
setRemoteChangeLog(information, robotNo, remoteMode, operateAction);
|
||||
sendRemoteMsgToRobotAndPP(true,robotNo);
|
||||
//todo 同步苏工和PP 包括车速
|
||||
sendRemoteMsgToRobotAndPP(robotNo);
|
||||
sendModeToRobot(robotNo,RemoteOperationModeEnum.MAN.getType());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -356,8 +367,8 @@ public class RemoteControllerInformationServiceImpl extends ServiceImpl<RemoteCo
|
||||
|
||||
String operateAction = information.getRemoteIp() + " 切换远遥模式为 " + RemoteModeEnum.getMsg(remoteMode);
|
||||
setRemoteChangeLog(information, robotNo, remoteMode, operateAction);
|
||||
sendRemoteMsgToRobotAndPP(true,robotNo);
|
||||
//todo 同步苏工和PP 包括车速
|
||||
sendRemoteMsgToRobotAndPP(robotNo);
|
||||
sendModeToRobot(robotNo,RemoteOperationModeEnum.MAN.getType());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -371,8 +382,8 @@ public class RemoteControllerInformationServiceImpl extends ServiceImpl<RemoteCo
|
||||
|
||||
String operateAction = information.getRemoteIp() + " 切换远遥模式为 " + RemoteModeEnum.getMsg(remoteMode);
|
||||
setRemoteChangeLog(information, robotNo, remoteMode, operateAction);
|
||||
sendRemoteMsgToRobotAndPP(false,robotNo);
|
||||
//todo 同步苏工和PP 包括车速
|
||||
sendRemoteMsgToRobotAndPP(robotNo);
|
||||
sendModeToRobot(robotNo,RemoteOperationModeEnum.AUTO.getType());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -398,18 +409,35 @@ public class RemoteControllerInformationServiceImpl extends ServiceImpl<RemoteCo
|
||||
|
||||
String operateAction = information.getRemoteIp() + " 切换远遥模式为 " + RemoteModeEnum.getMsg(remoteMode);
|
||||
setRemoteChangeLog(information, robotNo, remoteMode, operateAction);
|
||||
sendRemoteMsgToRobotAndPP(false,robotNo);
|
||||
//todo 同步苏工和PP 包括车速
|
||||
sendRemoteMsgToRobotAndPP(robotNo);
|
||||
sendModeToRobot(robotNo,RemoteOperationModeEnum.AUTO.getType());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 让车机切换模式
|
||||
*/
|
||||
public void sendModeToRobot(String robotNo, String operationMode) {
|
||||
RobotModeDTO robotModeDTO = new RobotModeDTO();
|
||||
robotModeDTO.setCommandType(RobotCommandTypeEnum.MODE.getType());
|
||||
robotModeDTO.setOperationMode(operationMode);
|
||||
if (RemoteOperationModeEnum.MAN.getType().equals(operationMode)) {
|
||||
String maxSpeed = robotMaxSpeedService.getRobotMaxSpeedByRobotNo(robotNo);
|
||||
if (ObjectUtil.isNotEmpty(maxSpeed)) {
|
||||
robotModeDTO.setMaxSpeed(Double.valueOf(maxSpeed));
|
||||
}
|
||||
}
|
||||
String mac = informationService.getMacByRobotNo(robotNo);
|
||||
commonApi.commonMethod(robotModeDTO, RobotTopicConstant.ROBOT_COMMAND_TOPIC + mac);
|
||||
log.info("发送消息让车机切换模式 :{}", JSON.toJSONString(robotModeDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送远遥信息给PP和车机
|
||||
* @param isAuto
|
||||
* @param robotNo
|
||||
*/
|
||||
public void sendRemoteMsgToRobotAndPP(Boolean isAuto, String robotNo){
|
||||
public void sendRemoteMsgToRobotAndPP( String robotNo){
|
||||
RemotePathPlanningDTO remotePathPlanning = new RemotePathPlanningDTO();
|
||||
remotePathPlanning.setRobotNo(robotNo);
|
||||
commonApi.commonMethod(remotePathPlanning, PathPlanningTopicConstant.START_REMOTE_CONTROLLER);
|
||||
@ -436,7 +464,7 @@ public class RemoteControllerInformationServiceImpl extends ServiceImpl<RemoteCo
|
||||
/**
|
||||
* 校验电量是否充足
|
||||
*
|
||||
* @param robotNo
|
||||
* @param information
|
||||
*/
|
||||
private void checkElectricity(RobotInformationDO information) {
|
||||
|
||||
|
@ -0,0 +1,89 @@
|
||||
package cn.iocoder.yudao.module.system.service.remote;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
|
||||
import cn.iocoder.yudao.module.system.api.remote.dto.RemoteRobotMaxSpeedDTO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.remote.vo.*;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.remote.RobotMaxSpeedDO;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
|
||||
/**
|
||||
* 远遥车辆最大速度 Service 接口
|
||||
*
|
||||
* @author 陈宾顺
|
||||
*/
|
||||
public interface RobotMaxSpeedService extends IService<RobotMaxSpeedDO> {
|
||||
|
||||
/**
|
||||
* 创建远遥车辆最大速度
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createRobotMaxSpeed(@Valid RobotMaxSpeedSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新远遥车辆最大速度
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateRobotMaxSpeed(@Valid RobotMaxSpeedSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除远遥车辆最大速度
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteRobotMaxSpeed(Long id);
|
||||
|
||||
/**
|
||||
* 获得远遥车辆最大速度
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 远遥车辆最大速度
|
||||
*/
|
||||
RobotMaxSpeedDO getRobotMaxSpeed(Long id);
|
||||
|
||||
/**
|
||||
* 获得远遥车辆最大速度分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 远遥车辆最大速度分页
|
||||
*/
|
||||
PageResult<RobotMaxSpeedDO> getRobotMaxSpeedPage(RobotMaxSpeedPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 更新车辆编号
|
||||
* @param oldRobotNo
|
||||
* @param newRobotNo
|
||||
*/
|
||||
void updateRobotNo(String oldRobotNo, String newRobotNo);
|
||||
|
||||
/**
|
||||
* 根据车辆编号删除
|
||||
* @param robotNo
|
||||
*/
|
||||
void deleteByRobotNo(String robotNo);
|
||||
|
||||
/**
|
||||
* 查询所有车辆速度
|
||||
* @return
|
||||
*/
|
||||
List<RemoteRobotMaxSpeedDTO> getAllRobotMaxSpeedList();
|
||||
|
||||
/**
|
||||
* 批量更新车辆速度
|
||||
* @param list
|
||||
*/
|
||||
void updateRobotMaxSpeedList(List<RemoteRobotMaxSpeedDTO> list);
|
||||
|
||||
/**
|
||||
* 根据车辆编号查询
|
||||
* @param robotNo
|
||||
*/
|
||||
String getRobotMaxSpeedByRobotNo(String robotNo);
|
||||
}
|
@ -0,0 +1,126 @@
|
||||
package cn.iocoder.yudao.module.system.service.remote;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.iocoder.yudao.module.system.api.remote.dto.RemoteRobotMaxSpeedDTO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.remote.vo.RobotMaxSpeedPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.remote.vo.RobotMaxSpeedRespVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.remote.vo.RobotMaxSpeedSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.houselane.WareHouseLaneDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.remote.RobotMaxSpeedDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotInformationDO;
|
||||
import cn.iocoder.yudao.module.system.dal.mysql.remote.RobotMaxSpeedMapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.ROBOT_MAX_SPEED_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
* 远遥车辆最大速度 Service 实现类
|
||||
*
|
||||
* @author 陈宾顺
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class RobotMaxSpeedServiceImpl extends ServiceImpl<RobotMaxSpeedMapper, RobotMaxSpeedDO> implements RobotMaxSpeedService {
|
||||
|
||||
@Resource
|
||||
private RobotMaxSpeedMapper robotMaxSpeedMapper;
|
||||
|
||||
@Override
|
||||
public Long createRobotMaxSpeed(RobotMaxSpeedSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
RobotMaxSpeedDO robotMaxSpeed = BeanUtils.toBean(createReqVO, RobotMaxSpeedDO.class);
|
||||
robotMaxSpeedMapper.insert(robotMaxSpeed);
|
||||
// 返回
|
||||
return robotMaxSpeed.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateRobotMaxSpeed(RobotMaxSpeedSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateRobotMaxSpeedExists(updateReqVO.getId());
|
||||
// 更新
|
||||
RobotMaxSpeedDO updateObj = BeanUtils.toBean(updateReqVO, RobotMaxSpeedDO.class);
|
||||
robotMaxSpeedMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteRobotMaxSpeed(Long id) {
|
||||
// 校验存在
|
||||
validateRobotMaxSpeedExists(id);
|
||||
// 删除
|
||||
robotMaxSpeedMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateRobotMaxSpeedExists(Long id) {
|
||||
if (robotMaxSpeedMapper.selectById(id) == null) {
|
||||
throw exception(ROBOT_MAX_SPEED_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public RobotMaxSpeedDO getRobotMaxSpeed(Long id) {
|
||||
return robotMaxSpeedMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<RobotMaxSpeedDO> getRobotMaxSpeedPage(RobotMaxSpeedPageReqVO pageReqVO) {
|
||||
return robotMaxSpeedMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新车辆编号
|
||||
*
|
||||
* @param oldRobotNo
|
||||
* @param newRobotNo
|
||||
*/
|
||||
@Override
|
||||
public void updateRobotNo(String oldRobotNo, String newRobotNo) {
|
||||
robotMaxSpeedMapper.updateRobotNo(oldRobotNo, newRobotNo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteByRobotNo(String robotNo) {
|
||||
robotMaxSpeedMapper.deleteByRobotNo(robotNo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RemoteRobotMaxSpeedDTO> getAllRobotMaxSpeedList() {
|
||||
List<RobotMaxSpeedDO> list = robotMaxSpeedMapper.selectList(new LambdaQueryWrapper<RobotMaxSpeedDO>());
|
||||
if (ObjectUtil.isEmpty(list)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
List<RemoteRobotMaxSpeedDTO> bean = BeanUtils.toBean(list, RemoteRobotMaxSpeedDTO.class);
|
||||
return bean;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateRobotMaxSpeedList(List<RemoteRobotMaxSpeedDTO> list) {
|
||||
List<RobotMaxSpeedDO> bean = BeanUtils.toBean(list, RobotMaxSpeedDO.class);
|
||||
robotMaxSpeedMapper.updateById(bean);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRobotMaxSpeedByRobotNo(String robotNo) {
|
||||
RobotMaxSpeedDO robotMaxSpeedDO = robotMaxSpeedMapper.selectOne(new LambdaQueryWrapper<RobotMaxSpeedDO>()
|
||||
.eq(RobotMaxSpeedDO::getRobotNo, robotNo)
|
||||
.last("limit 1"));
|
||||
return ObjectUtil.isEmpty(robotMaxSpeedDO) ? null : robotMaxSpeedDO.getMaxSpeed();
|
||||
}
|
||||
|
||||
}
|
@ -32,6 +32,7 @@ import cn.iocoder.yudao.module.system.constant.robot.RobotTaskChcheConstant;
|
||||
import cn.iocoder.yudao.module.system.constant.robot.RobotTopicConstant;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.config.vo.CommonConfigVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.log.vo.UserOperationLogSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.remote.vo.RobotMaxSpeedSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.robot.camera.RobotCameraAddVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.robot.proceed.RobotTaskProceedSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.robot.vo.*;
|
||||
@ -73,6 +74,7 @@ import cn.iocoder.yudao.module.system.service.log.RobotTaskDetailActionLogServic
|
||||
import cn.iocoder.yudao.module.system.service.log.UserOperationLogService;
|
||||
import cn.iocoder.yudao.module.system.service.positionmap.PositionMapItemService;
|
||||
import cn.iocoder.yudao.module.system.service.remote.RemoteControllerInformationService;
|
||||
import cn.iocoder.yudao.module.system.service.remote.RobotMaxSpeedService;
|
||||
import cn.iocoder.yudao.module.system.service.robot.camera.RobotCameraService;
|
||||
import cn.iocoder.yudao.module.system.service.robot.pathplanning.RobotPathPlanningService;
|
||||
import cn.iocoder.yudao.module.system.service.robot.proceed.RobotTaskProceedService;
|
||||
@ -187,6 +189,9 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
|
||||
@Resource
|
||||
private RobotMapStopMapper mapStopMapper;
|
||||
|
||||
@Resource
|
||||
private RobotMaxSpeedService robotMaxSpeedService;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Long createInformation(RobotInformationSaveReqVO createReqVO) {
|
||||
@ -248,6 +253,10 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
|
||||
pathPlanningApi.synchronousLineObject(list, PathPlanningTopicConstant.SEND_ROBOT_DIMENSIONS);
|
||||
|
||||
redisUtil.del(key);
|
||||
|
||||
RobotMaxSpeedSaveReqVO robotMaxSpeedSave = new RobotMaxSpeedSaveReqVO();
|
||||
robotMaxSpeedSave.setRobotNo(information.getRobotNo());
|
||||
robotMaxSpeedService.createRobotMaxSpeed(robotMaxSpeedSave);
|
||||
// 返回
|
||||
return information.getId();
|
||||
}
|
||||
@ -313,6 +322,7 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
|
||||
informationMapper.updateById(updateObj);
|
||||
|
||||
if (!robotInformationDO.getRobotNo().equals(updateReqVO.getRobotNo())) {
|
||||
robotMaxSpeedService.updateRobotNo(robotInformationDO.getRobotNo(),updateReqVO.getRobotNo());
|
||||
List<RobotMapStopDO> robotMapStops = mapStopMapper.selectList(new LambdaQueryWrapperX<RobotMapStopDO>()
|
||||
.eq(RobotMapStopDO::getRobotNo, robotInformationDO.getRobotNo()));
|
||||
if (ObjectUtil.isNotEmpty(robotMapStops)) {
|
||||
@ -346,17 +356,19 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
|
||||
//地图相关
|
||||
String floorAreaKey = RobotTaskChcheConstant.ROBOT_FLOOR_AREA + robotInformationDO.getMacAddress();
|
||||
Object o = redisUtil.get(floorAreaKey);
|
||||
FloorZoneDTO floorZone = JSON.parseObject((String) o, FloorZoneDTO.class);
|
||||
String oldFloorArea = floorZone.getFloor() + "-" + floorZone.getArea();
|
||||
redisUtil.hdel(oldFloorArea, robotInformationDO.getRobotNo());
|
||||
redisUtil.del(floorAreaKey);
|
||||
if (ObjectUtil.isNotEmpty(o)) {
|
||||
String newFloorAreaKey = RobotTaskChcheConstant.ROBOT_FLOOR_AREA + updateReqVO.getMacAddress();
|
||||
redisUtil.set(newFloorAreaKey, JSON.toJSONString(floorZone));
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
String value = floorZone.getFloor() + "-" + floorZone.getArea();
|
||||
map.put(updateReqVO.getRobotNo(), value);
|
||||
redisUtil.hmset(value, map);
|
||||
FloorZoneDTO floorZone = JSON.parseObject((String) o, FloorZoneDTO.class);
|
||||
String oldFloorArea = floorZone.getFloor() + "-" + floorZone.getArea();
|
||||
redisUtil.hdel(oldFloorArea, robotInformationDO.getRobotNo());
|
||||
redisUtil.del(floorAreaKey);
|
||||
if (ObjectUtil.isNotEmpty(o)) {
|
||||
String newFloorAreaKey = RobotTaskChcheConstant.ROBOT_FLOOR_AREA + updateReqVO.getMacAddress();
|
||||
redisUtil.set(newFloorAreaKey, JSON.toJSONString(floorZone));
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
String value = floorZone.getFloor() + "-" + floorZone.getArea();
|
||||
map.put(updateReqVO.getRobotNo(), value);
|
||||
redisUtil.hmset(value, map);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -404,10 +416,14 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
|
||||
//地图相关
|
||||
String floorAreaKey = RobotTaskChcheConstant.ROBOT_FLOOR_AREA + robotInformationDO.getMacAddress();
|
||||
Object o = redisUtil.get(floorAreaKey);
|
||||
FloorZoneDTO floorZone = JSON.parseObject((String) o, FloorZoneDTO.class);
|
||||
String oldFloorArea = floorZone.getFloor() + "-" + floorZone.getArea();
|
||||
redisUtil.hdel(oldFloorArea, robotInformationDO.getRobotNo());
|
||||
redisUtil.del(floorAreaKey);
|
||||
if (ObjectUtil.isNotEmpty(o)) {
|
||||
FloorZoneDTO floorZone = JSON.parseObject((String) o, FloorZoneDTO.class);
|
||||
String oldFloorArea = floorZone.getFloor() + "-" + floorZone.getArea();
|
||||
redisUtil.hdel(oldFloorArea, robotInformationDO.getRobotNo());
|
||||
redisUtil.del(floorAreaKey);
|
||||
}
|
||||
|
||||
robotMaxSpeedService.deleteByRobotNo(robotInformationDO.getRobotNo());
|
||||
}
|
||||
|
||||
public void releaseRobotStop(RobotInformationDO robotInformationDO) {
|
||||
|
@ -0,0 +1,27 @@
|
||||
<?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="cn.iocoder.yudao.module.system.dal.mysql.remote.RobotMaxSpeedMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
<update id="updateRobotNo">
|
||||
update
|
||||
remote_robot_max_speed
|
||||
set
|
||||
robot_no = #{newRobotNo}
|
||||
where
|
||||
robot_no = #{oldRobotNo}
|
||||
</update>
|
||||
|
||||
<delete id="deleteByRobotNo">
|
||||
delete
|
||||
from remote_robot_max_speed
|
||||
where
|
||||
robot_no = #{robotNo}
|
||||
</delete>
|
||||
</mapper>
|
Loading…
Reference in New Issue
Block a user