地图暂停和恢复
This commit is contained in:
parent
69a0ebe694
commit
d595f15872
@ -268,4 +268,6 @@ public interface ErrorCodeConstants {
|
|||||||
ErrorCode USER_OPERATION_LOG_NOT_EXISTS = new ErrorCode(1_002_050_001, "用户操作记录不存在");
|
ErrorCode USER_OPERATION_LOG_NOT_EXISTS = new ErrorCode(1_002_050_001, "用户操作记录不存在");
|
||||||
// ========== 车辆衔接任务 1_002_051_001 ==========
|
// ========== 车辆衔接任务 1_002_051_001 ==========
|
||||||
ErrorCode TASK_PROCEED_NOT_EXISTS = new ErrorCode(1_002_051_001, "车辆衔接任务不存在");
|
ErrorCode TASK_PROCEED_NOT_EXISTS = new ErrorCode(1_002_051_001, "车辆衔接任务不存在");
|
||||||
|
// ========== 车辆(地图)急停记录 1_002_052_001 ==========
|
||||||
|
ErrorCode MAP_STOP_NOT_EXISTS = new ErrorCode(1_002_052_001, "车辆(地图)急停记录不存在");
|
||||||
}
|
}
|
||||||
|
@ -18,10 +18,10 @@ public class SystemApplicationRunner implements ApplicationRunner {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(ApplicationArguments args) {
|
public void run(ApplicationArguments args) {
|
||||||
try {
|
/*try {
|
||||||
toolsService.simulationPose();
|
toolsService.simulationPose();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("同步仿真的点位信息失败 :{}",e.getMessage());
|
log.error("同步仿真的点位信息失败 :{}",e.getMessage());
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.system.controller.admin.positionmap;
|
|||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.positionmap.dto.PositionMapDTO;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.positionmap.vo.PositionMapRespVO;
|
import cn.iocoder.yudao.module.system.controller.admin.positionmap.vo.PositionMapRespVO;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.positionmap.PositionMapDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.positionmap.PositionMapDO;
|
||||||
import cn.iocoder.yudao.module.system.service.positionmap.PositionMapService;
|
import cn.iocoder.yudao.module.system.service.positionmap.PositionMapService;
|
||||||
@ -54,6 +55,7 @@ public class PositionMapController {
|
|||||||
@GetMapping("/emergencyStopOrRecovery")
|
@GetMapping("/emergencyStopOrRecovery")
|
||||||
@Operation(summary = "一键急停or一键恢复地图上所有AGV")
|
@Operation(summary = "一键急停or一键恢复地图上所有AGV")
|
||||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@Parameter(name = "type", description = "类型(1:停止, 0:恢复)", required = true, example = "1024")
|
||||||
@PreAuthorize("@ss.hasPermission('system:position-map:emergencyStopOrRecovery')")
|
@PreAuthorize("@ss.hasPermission('system:position-map:emergencyStopOrRecovery')")
|
||||||
public CommonResult<Boolean> emergencyStopOrRecovery(@RequestParam("id") Long id, @RequestParam("type") Integer type) {
|
public CommonResult<Boolean> emergencyStopOrRecovery(@RequestParam("id") Long id, @RequestParam("type") Integer type) {
|
||||||
positionMapService.emergencyStopOrRecovery(id,type);
|
positionMapService.emergencyStopOrRecovery(id,type);
|
||||||
@ -63,10 +65,11 @@ public class PositionMapController {
|
|||||||
@GetMapping("/getMap")
|
@GetMapping("/getMap")
|
||||||
@Operation(summary = "获得仓库点位地图Map")
|
@Operation(summary = "获得仓库点位地图Map")
|
||||||
@PreAuthorize("@ss.hasPermission('system:position-map:query')")
|
@PreAuthorize("@ss.hasPermission('system:position-map:query')")
|
||||||
public CommonResult<Map<Integer, List<PositionMapDO>>> getPositionMapList() {
|
public CommonResult<Map<Integer, List<PositionMapDTO>>> getPositionMapList() {
|
||||||
List<PositionMapDO> list = positionMapService.list();
|
Map<Integer, List<PositionMapDTO>> result = positionMapService.getPositionMapList();
|
||||||
Map<Integer, List<PositionMapDO>> map = list.stream().collect(Collectors.groupingBy(PositionMapDO::getFloor));
|
/*List<PositionMapDO> list = positionMapService.list();
|
||||||
return success(map);
|
Map<Integer, List<PositionMapDO>> map = list.stream().collect(Collectors.groupingBy(PositionMapDO::getFloor));*/
|
||||||
|
return success(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/upload")
|
@PostMapping("/upload")
|
||||||
|
@ -0,0 +1,31 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.controller.admin.positionmap.dto;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 仓库点位地图新增/修改 Request VO")
|
||||||
|
@Data
|
||||||
|
public class PositionMapDTO {
|
||||||
|
|
||||||
|
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "2349")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "楼层")
|
||||||
|
private Integer floor;
|
||||||
|
|
||||||
|
@Schema(description = "区域")
|
||||||
|
private String area;
|
||||||
|
|
||||||
|
@Schema(description = "AGV地图ymlJson信息")
|
||||||
|
private String yamlJson;
|
||||||
|
|
||||||
|
@Schema(description = "AGV地图图片路径")
|
||||||
|
private String pngUrl;
|
||||||
|
|
||||||
|
@Schema(description = "AGV地图yaml路径")
|
||||||
|
private String yamlUrl;
|
||||||
|
|
||||||
|
@Schema(description = "地图暂停/恢复 (0:未暂停, 1:暂停)")
|
||||||
|
private Integer stopOrRestore = 0;
|
||||||
|
}
|
@ -0,0 +1,96 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.controller.admin.robot;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.robot.mapstop.RobotMapStopPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.robot.mapstop.RobotMapStopRespVO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.robot.mapstop.RobotMapStopSaveReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotMapStopDO;
|
||||||
|
import cn.iocoder.yudao.module.system.service.robot.mapstop.RobotMapStopService;
|
||||||
|
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/robot/map-stop")
|
||||||
|
@Validated
|
||||||
|
public class RobotMapStopController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private RobotMapStopService mapStopService;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@Operation(summary = "创建车辆(地图)急停记录")
|
||||||
|
@PreAuthorize("@ss.hasPermission('robot:map-stop:create')")
|
||||||
|
public CommonResult<Long> createMapStop(@Valid @RequestBody RobotMapStopSaveReqVO createReqVO) {
|
||||||
|
return success(mapStopService.createMapStop(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新车辆(地图)急停记录")
|
||||||
|
@PreAuthorize("@ss.hasPermission('robot:map-stop:update')")
|
||||||
|
public CommonResult<Boolean> updateMapStop(@Valid @RequestBody RobotMapStopSaveReqVO updateReqVO) {
|
||||||
|
mapStopService.updateMapStop(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@Operation(summary = "删除车辆(地图)急停记录")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('robot:map-stop:delete')")
|
||||||
|
public CommonResult<Boolean> deleteMapStop(@RequestParam("id") Long id) {
|
||||||
|
mapStopService.deleteMapStop(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得车辆(地图)急停记录")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@PreAuthorize("@ss.hasPermission('robot:map-stop:query')")
|
||||||
|
public CommonResult<RobotMapStopRespVO> getMapStop(@RequestParam("id") Long id) {
|
||||||
|
RobotMapStopDO mapStop = mapStopService.getMapStop(id);
|
||||||
|
return success(BeanUtils.toBean(mapStop, RobotMapStopRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得车辆(地图)急停记录分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('robot:map-stop:query')")
|
||||||
|
public CommonResult<PageResult<RobotMapStopRespVO>> getMapStopPage(@Valid RobotMapStopPageReqVO pageReqVO) {
|
||||||
|
PageResult<RobotMapStopDO> pageResult = mapStopService.getMapStopPage(pageReqVO);
|
||||||
|
return success(BeanUtils.toBean(pageResult, RobotMapStopRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/export-excel")
|
||||||
|
@Operation(summary = "导出车辆(地图)急停记录 Excel")
|
||||||
|
@PreAuthorize("@ss.hasPermission('robot:map-stop:export')")
|
||||||
|
@ApiAccessLog(operateType = EXPORT)
|
||||||
|
public void exportMapStopExcel(@Valid RobotMapStopPageReqVO pageReqVO,
|
||||||
|
HttpServletResponse response) throws IOException {
|
||||||
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||||
|
List<RobotMapStopDO> list = mapStopService.getMapStopPage(pageReqVO).getList();
|
||||||
|
// 导出 Excel
|
||||||
|
ExcelUtils.write(response, "车辆(地图)急停记录.xls", "数据", RobotMapStopRespVO.class,
|
||||||
|
BeanUtils.toBean(list, RobotMapStopRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,31 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.controller.admin.robot.mapstop;
|
||||||
|
|
||||||
|
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 RobotMapStopPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "急停仓库点位地图表id", example = "20550")
|
||||||
|
private Long positionMapId;
|
||||||
|
|
||||||
|
@Schema(description = "急停的AGV编号")
|
||||||
|
private String robotNo;
|
||||||
|
|
||||||
|
@Schema(description = "类型(0:地图、1:车辆)", example = "2")
|
||||||
|
private Integer stopType;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] createTime;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,35 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.controller.admin.robot.mapstop;
|
||||||
|
|
||||||
|
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 RobotMapStopRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1220")
|
||||||
|
@ExcelProperty("主键ID")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "急停仓库点位地图表id", example = "20550")
|
||||||
|
@ExcelProperty("急停仓库点位地图表id")
|
||||||
|
private Long positionMapId;
|
||||||
|
|
||||||
|
@Schema(description = "急停的AGV编号")
|
||||||
|
@ExcelProperty("急停的AGV编号")
|
||||||
|
private String robotNo;
|
||||||
|
|
||||||
|
@Schema(description = "类型(0:地图、1:车辆)", example = "2")
|
||||||
|
@ExcelProperty("类型(0:地图、1:车辆)")
|
||||||
|
private Integer stopType;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.controller.admin.robot.mapstop;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 车辆(地图)急停记录新增/修改 Request VO")
|
||||||
|
@Data
|
||||||
|
public class RobotMapStopSaveReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1220")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "急停仓库点位地图表id", example = "20550")
|
||||||
|
private Long positionMapId;
|
||||||
|
|
||||||
|
@Schema(description = "急停的AGV编号")
|
||||||
|
private String robotNo;
|
||||||
|
|
||||||
|
@Schema(description = "类型(0:地图、1:车辆)", example = "2")
|
||||||
|
private Integer stopType;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,40 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.dal.dataobject.robot;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆(地图)急停记录 DO
|
||||||
|
*
|
||||||
|
* @author 陈宾顺
|
||||||
|
*/
|
||||||
|
@TableName("robot_map_stop")
|
||||||
|
@KeySequence("robot_map_stop_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class RobotMapStopDO extends BaseDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键ID
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 急停仓库点位地图表id
|
||||||
|
*/
|
||||||
|
private Long positionMapId;
|
||||||
|
/**
|
||||||
|
* 急停的AGV编号
|
||||||
|
*/
|
||||||
|
private String robotNo;
|
||||||
|
/**
|
||||||
|
* 类型(0:地图、1:车辆)
|
||||||
|
*/
|
||||||
|
private Integer stopType;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.dal.mysql.robot;
|
||||||
|
|
||||||
|
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.robot.mapstop.RobotMapStopPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotMapStopDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆(地图)急停记录 Mapper
|
||||||
|
*
|
||||||
|
* @author 陈宾顺
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface RobotMapStopMapper extends BaseMapperX<RobotMapStopDO> {
|
||||||
|
|
||||||
|
default PageResult<RobotMapStopDO> selectPage(RobotMapStopPageReqVO reqVO) {
|
||||||
|
return selectPage(reqVO, new LambdaQueryWrapperX<RobotMapStopDO>()
|
||||||
|
.eqIfPresent(RobotMapStopDO::getPositionMapId, reqVO.getPositionMapId())
|
||||||
|
.eqIfPresent(RobotMapStopDO::getRobotNo, reqVO.getRobotNo())
|
||||||
|
.eqIfPresent(RobotMapStopDO::getStopType, reqVO.getStopType())
|
||||||
|
.betweenIfPresent(RobotMapStopDO::getCreateTime, reqVO.getCreateTime())
|
||||||
|
.orderByDesc(RobotMapStopDO::getId));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,6 +1,7 @@
|
|||||||
package cn.iocoder.yudao.module.system.service.positionmap;
|
package cn.iocoder.yudao.module.system.service.positionmap;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.positionmap.dto.PositionMapDTO;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.positionmap.vo.PositionMapPageReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.positionmap.vo.PositionMapPageReqVO;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.positionmap.vo.PositionMapSaveReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.positionmap.vo.PositionMapSaveReqVO;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.positionmap.PositionMapDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.positionmap.PositionMapDO;
|
||||||
@ -11,6 +12,7 @@ import javax.servlet.http.HttpServletResponse;
|
|||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 仓库点位地图 Service 接口
|
* 仓库点位地图 Service 接口
|
||||||
@ -101,4 +103,10 @@ public interface PositionMapService extends IService<PositionMapDO> {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<PositionMapDO> getAllMap();
|
List<PositionMapDO> getAllMap();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取地图及显示地图是否暂停
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Map<Integer, List<PositionMapDTO>> getPositionMapList();
|
||||||
}
|
}
|
||||||
|
@ -10,22 +10,22 @@ import cn.iocoder.yudao.module.mqtt.api.common.CommonApi;
|
|||||||
import cn.iocoder.yudao.module.mqtt.api.task.dto.RobotSimulationPoseDTO;
|
import cn.iocoder.yudao.module.mqtt.api.task.dto.RobotSimulationPoseDTO;
|
||||||
import cn.iocoder.yudao.module.system.constant.robot.RobotTopicConstant;
|
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.log.vo.UserOperationLogSaveReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.positionmap.dto.PositionMapDTO;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.positionmap.vo.PositionMapPageReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.positionmap.vo.PositionMapPageReqVO;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.positionmap.vo.PositionMapSaveReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.positionmap.vo.PositionMapSaveReqVO;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.information.DeviceInformationDO;
|
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.positionmap.PositionMapDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.positionmap.PositionMapDO;
|
||||||
import cn.iocoder.yudao.module.system.dal.mysql.positionmap.PositionMapMapper;
|
import cn.iocoder.yudao.module.system.dal.mysql.positionmap.PositionMapMapper;
|
||||||
import cn.iocoder.yudao.module.system.enums.common.ZeroOneEnum;
|
import cn.iocoder.yudao.module.system.enums.common.ZeroOneEnum;
|
||||||
import cn.iocoder.yudao.module.system.enums.robot.task.RobotCommandTypeEnum;
|
import cn.iocoder.yudao.module.system.enums.robot.task.RobotCommandTypeEnum;
|
||||||
import cn.iocoder.yudao.module.system.service.log.UserOperationLogService;
|
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.RobotInformationService;
|
||||||
|
import cn.iocoder.yudao.module.system.service.robot.mapstop.RobotMapStopService;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.cache.annotation.Cacheable;
|
import org.springframework.cache.annotation.Cacheable;
|
||||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
||||||
import org.springframework.http.HttpHeaders;
|
import org.springframework.http.HttpHeaders;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@ -74,6 +74,9 @@ public class PositionMapServiceImpl extends ServiceImpl<PositionMapMapper, Posit
|
|||||||
@Resource
|
@Resource
|
||||||
private CommonApi commonApi;
|
private CommonApi commonApi;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private RobotMapStopService robotMapStopService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long createPositionMap(PositionMapSaveReqVO createReqVO) {
|
public Long createPositionMap(PositionMapSaveReqVO createReqVO) {
|
||||||
// 插入
|
// 插入
|
||||||
@ -350,4 +353,26 @@ public class PositionMapServiceImpl extends ServiceImpl<PositionMapMapper, Posit
|
|||||||
return positionMapMapper.selectList(new LambdaQueryWrapperX<PositionMapDO>().orderByDesc(PositionMapDO::getId));
|
return positionMapMapper.selectList(new LambdaQueryWrapperX<PositionMapDO>().orderByDesc(PositionMapDO::getId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<Integer, List<PositionMapDTO>> getPositionMapList() {
|
||||||
|
List<PositionMapDO> allMap = getAllMap();
|
||||||
|
if (ObjectUtil.isEmpty(allMap)) {
|
||||||
|
return Collections.emptyMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
List<PositionMapDTO> list = BeanUtils.toBean(allMap, PositionMapDTO.class);
|
||||||
|
List<Long> stopMapIds = robotMapStopService.getStopMapIds();
|
||||||
|
if (ObjectUtil.isEmpty(stopMapIds)) {
|
||||||
|
return list.stream().collect(Collectors.groupingBy(PositionMapDTO::getFloor));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (PositionMapDTO positionMap : list) {
|
||||||
|
if (stopMapIds.contains(positionMap.getId())) {
|
||||||
|
positionMap.setStopOrRestore(ZeroOneEnum.ONE.getType());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return list.stream().collect(Collectors.groupingBy(PositionMapDTO::getFloor));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,63 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.service.robot.mapstop;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import javax.validation.*;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.robot.mapstop.RobotMapStopPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.robot.mapstop.RobotMapStopSaveReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotMapStopDO;
|
||||||
|
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 RobotMapStopService extends IService<RobotMapStopDO> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建车辆(地图)急停记录
|
||||||
|
*
|
||||||
|
* @param createReqVO 创建信息
|
||||||
|
* @return 编号
|
||||||
|
*/
|
||||||
|
Long createMapStop(@Valid RobotMapStopSaveReqVO createReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新车辆(地图)急停记录
|
||||||
|
*
|
||||||
|
* @param updateReqVO 更新信息
|
||||||
|
*/
|
||||||
|
void updateMapStop(@Valid RobotMapStopSaveReqVO updateReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除车辆(地图)急停记录
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
*/
|
||||||
|
void deleteMapStop(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得车辆(地图)急停记录
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @return 车辆(地图)急停记录
|
||||||
|
*/
|
||||||
|
RobotMapStopDO getMapStop(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得车辆(地图)急停记录分页
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return 车辆(地图)急停记录分页
|
||||||
|
*/
|
||||||
|
PageResult<RobotMapStopDO> getMapStopPage(RobotMapStopPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询暂停的地图
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<Long> getStopMapIds();
|
||||||
|
}
|
@ -0,0 +1,96 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.service.robot.mapstop;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.robot.mapstop.RobotMapStopPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.robot.mapstop.RobotMapStopSaveReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.positionmap.PositionMapItemDO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotMapStopDO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.mysql.robot.RobotMapStopMapper;
|
||||||
|
import cn.iocoder.yudao.module.system.enums.common.ZeroOneEnum;
|
||||||
|
import cn.iocoder.yudao.module.system.enums.item.PositionMapItemEnum;
|
||||||
|
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 java.util.stream.Collectors;
|
||||||
|
|
||||||
|
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.MAP_STOP_NOT_EXISTS;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆(地图)急停记录 Service 实现类
|
||||||
|
*
|
||||||
|
* @author 陈宾顺
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
public class RobotMapStopServiceImpl extends ServiceImpl<RobotMapStopMapper, RobotMapStopDO> implements RobotMapStopService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private RobotMapStopMapper mapStopMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long createMapStop(RobotMapStopSaveReqVO createReqVO) {
|
||||||
|
// 插入
|
||||||
|
RobotMapStopDO mapStop = BeanUtils.toBean(createReqVO, RobotMapStopDO.class);
|
||||||
|
mapStopMapper.insert(mapStop);
|
||||||
|
// 返回
|
||||||
|
return mapStop.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateMapStop(RobotMapStopSaveReqVO updateReqVO) {
|
||||||
|
// 校验存在
|
||||||
|
validateMapStopExists(updateReqVO.getId());
|
||||||
|
// 更新
|
||||||
|
RobotMapStopDO updateObj = BeanUtils.toBean(updateReqVO, RobotMapStopDO.class);
|
||||||
|
mapStopMapper.updateById(updateObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteMapStop(Long id) {
|
||||||
|
// 校验存在
|
||||||
|
validateMapStopExists(id);
|
||||||
|
// 删除
|
||||||
|
mapStopMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validateMapStopExists(Long id) {
|
||||||
|
if (mapStopMapper.selectById(id) == null) {
|
||||||
|
throw exception(MAP_STOP_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RobotMapStopDO getMapStop(Long id) {
|
||||||
|
return mapStopMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<RobotMapStopDO> getMapStopPage(RobotMapStopPageReqVO pageReqVO) {
|
||||||
|
return mapStopMapper.selectPage(pageReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Long> getStopMapIds() {
|
||||||
|
List<RobotMapStopDO> positionMapItems = mapStopMapper.selectList(new LambdaQueryWrapperX<RobotMapStopDO>()
|
||||||
|
.eq(RobotMapStopDO::getStopType, ZeroOneEnum.ZERO.getType()));
|
||||||
|
if (ObjectUtil.isEmpty(positionMapItems)) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
return positionMapItems.stream()
|
||||||
|
.map(RobotMapStopDO::getPositionMapId)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
<?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.robot.RobotMapStopMapper">
|
||||||
|
|
||||||
|
<!--
|
||||||
|
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||||
|
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||||
|
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||||
|
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||||
|
-->
|
||||||
|
|
||||||
|
</mapper>
|
Loading…
Reference in New Issue
Block a user