转换点绑定
This commit is contained in:
parent
2c6a9aed45
commit
fa3bb9911e
@ -0,0 +1,15 @@
|
||||
package cn.iocoder.yudao.module.mqtt.api.path.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class PositionAllChangePointBindingDTO {
|
||||
/**
|
||||
* 点位1的id
|
||||
*/
|
||||
private Long startingPointId;
|
||||
/**
|
||||
* 点位2的id
|
||||
*/
|
||||
private Long endPointId;
|
||||
}
|
@ -304,4 +304,7 @@ public interface ErrorCodeConstants {
|
||||
|
||||
// ========== 远遥任务转移记录 1_002_056_001 ==========
|
||||
ErrorCode CONTROLLER_TASK_TRANSFER_LOG_NOT_EXISTS = new ErrorCode(1_002_056_001, "远遥任务转移记录不存在");
|
||||
|
||||
// ========== 区域变更点绑定 1_002_057_001 ==========
|
||||
ErrorCode POSITION_CHANGE_POINT_BINDING_NOT_EXISTS = new ErrorCode(1_002_057_001, "区域变更点绑定不存在");
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
|
||||
import cn.iocoder.yudao.module.system.config.ratelimiter.SystemRateLimiter;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.positionmap.vo.PositionMapSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.service.path.PathPlanningService;
|
||||
import cn.iocoder.yudao.module.system.service.positionmap.PositionChangePointBindingService;
|
||||
import cn.iocoder.yudao.module.system.service.robot.RobotTaskService;
|
||||
import cn.iocoder.yudao.module.system.service.robot.RobotWarnMsgService;
|
||||
import cn.iocoder.yudao.module.system.service.tool.ToolsService;
|
||||
@ -40,6 +41,8 @@ public class PathApiImpl implements PathApi {
|
||||
@Resource
|
||||
private RobotWarnMsgService warnMsgService;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 发送初始化信息给PP
|
||||
*/
|
||||
@ -59,6 +62,8 @@ public class PathApiImpl implements PathApi {
|
||||
pathPlanningService.robotDimensions();
|
||||
//距离、优先级、时间权重
|
||||
toolsService.sendPPsortConfig();
|
||||
//同步区域变更点的绑定信息
|
||||
pathPlanningService.sendPositionChangePointBinding();
|
||||
log.info("初始化数据发送个PP---完成");
|
||||
});
|
||||
}
|
||||
|
@ -104,5 +104,10 @@ public class PathPlanningTopicConstant {
|
||||
*/
|
||||
public static String CLOSE_REMOTE_CONTROLLER = "CLOSE_REMOTE_CONTROLLER";
|
||||
|
||||
/**
|
||||
* 区域等待点绑定信息
|
||||
*/
|
||||
public static String SYNCHRONOUS_ALL_CHANGE_POINT_BINDING = "SYNCHRONOUS_ALL_CHANGE_POINT_BINDING";
|
||||
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,76 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.positionmap;
|
||||
|
||||
import cn.iocoder.yudao.module.system.controller.admin.positionmap.dto.PositionChangePointBindingDTO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.positionmap.vo.PositionChangePointBindingSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.positionmap.vo.PositionMapItemSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.service.positionmap.PositionChangePointBindingService;
|
||||
import cn.iocoder.yudao.module.system.service.positionmap.PositionMapItemService;
|
||||
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 cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
|
||||
|
||||
@Tag(name = "管理后台 - 区域变更点绑定")
|
||||
@RestController
|
||||
@RequestMapping("/system/position-change-point-binding")
|
||||
@Validated
|
||||
public class PositionChangePointBindingController {
|
||||
|
||||
@Resource
|
||||
private PositionChangePointBindingService positionChangePointBindingService;
|
||||
|
||||
@Resource
|
||||
private PositionMapItemService positionMapItemService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建区域变更点绑定")
|
||||
@PreAuthorize("@ss.hasPermission('system:position-change-point-binding:create')")
|
||||
public CommonResult<Long> createPositionChangePointBinding(@Valid @RequestBody PositionChangePointBindingSaveReqVO createReqVO) {
|
||||
return success(positionChangePointBindingService.createPositionChangePointBinding(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新区域变更点绑定")
|
||||
@PreAuthorize("@ss.hasPermission('system:position-change-point-binding:update')")
|
||||
public CommonResult<Boolean> updatePositionChangePointBinding(@Valid @RequestBody PositionChangePointBindingSaveReqVO updateReqVO) {
|
||||
positionChangePointBindingService.updatePositionChangePointBinding(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除区域变更点绑定")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('system:position-change-point-binding:delete')")
|
||||
public CommonResult<Boolean> deletePositionChangePointBinding(@RequestParam("id") Long id) {
|
||||
positionChangePointBindingService.deletePositionChangePointBinding(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "根据点位id,查询此点位已经绑定的转换点信息")
|
||||
@Parameter(name = "id", description = "点位id", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('system:position-change-point-binding:query')")
|
||||
public CommonResult<PositionChangePointBindingDTO> getPositionChangePointBinding(@RequestParam("id") Long id) {
|
||||
PositionChangePointBindingDTO positionChangePointBinding = positionChangePointBindingService.getPositionChangePointBinding(id);
|
||||
return success(positionChangePointBinding);
|
||||
}
|
||||
|
||||
@GetMapping("/getItemBySortNum")
|
||||
@Operation(summary = "根据排序查询点位信息")
|
||||
@Parameter(name = "sortNum", description = "点位自增排序", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('system:position-change-point-binding:getItemBySortNum')")
|
||||
public CommonResult<PositionMapItemSaveReqVO> getItemBySortNum(@RequestParam("sortNum") Long sortNum) {
|
||||
PositionMapItemSaveReqVO positionMapItemSaveReqVO = positionMapItemService.getItemBySortNum(sortNum);
|
||||
return success(positionMapItemSaveReqVO);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.positionmap.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class PositionChangePointBindingDTO {
|
||||
|
||||
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "31007")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "另一个区域变更点的点位自增排序")
|
||||
private Long sortNum;
|
||||
|
||||
@Schema(description = "另一个区域变更点的主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "31007")
|
||||
private Long pointId;
|
||||
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.positionmap.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 PositionChangePointBindingPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "点位1的id", example = "4491")
|
||||
private Long startingPointId;
|
||||
|
||||
@Schema(description = "点位2的id", example = "24948")
|
||||
private Long endPointId;
|
||||
|
||||
@Schema(description = "点位1自增排序")
|
||||
private Long startingPointSortNum;
|
||||
|
||||
@Schema(description = "点位2自增排序")
|
||||
private Long endPointSortNum;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.positionmap.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 PositionChangePointBindingRespVO {
|
||||
|
||||
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "17369")
|
||||
@ExcelProperty("主键ID")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "点位1的id", example = "4491")
|
||||
@ExcelProperty("点位1的id")
|
||||
private Long startingPointId;
|
||||
|
||||
@Schema(description = "点位2的id", example = "24948")
|
||||
@ExcelProperty("点位2的id")
|
||||
private Long endPointId;
|
||||
|
||||
@Schema(description = "点位1自增排序")
|
||||
@ExcelProperty("点位1自增排序")
|
||||
private Long startingPointSortNum;
|
||||
|
||||
@Schema(description = "点位2自增排序")
|
||||
@ExcelProperty("点位2自增排序")
|
||||
private Long endPointSortNum;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.positionmap.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 PositionChangePointBindingSaveReqVO {
|
||||
|
||||
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "17369")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "点位1的id", example = "4491")
|
||||
private Long startingPointId;
|
||||
|
||||
@Schema(description = "点位2的id", example = "24948")
|
||||
private Long endPointId;
|
||||
|
||||
@Schema(description = "点位1自增排序")
|
||||
private Long startingPointSortNum;
|
||||
|
||||
@Schema(description = "点位2自增排序")
|
||||
private Long endPointSortNum;
|
||||
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package cn.iocoder.yudao.module.system.dal.dataobject.positionmap;
|
||||
|
||||
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("ware_position_change_point_binding")
|
||||
@KeySequence("ware_position_change_point_binding_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PositionChangePointBindingDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 点位1的id
|
||||
*/
|
||||
private Long startingPointId;
|
||||
/**
|
||||
* 点位2的id
|
||||
*/
|
||||
private Long endPointId;
|
||||
/**
|
||||
* 点位1自增排序
|
||||
*/
|
||||
private Long startingPointSortNum;
|
||||
/**
|
||||
* 点位2自增排序
|
||||
*/
|
||||
private Long endPointSortNum;
|
||||
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package cn.iocoder.yudao.module.system.dal.mysql.positionmap;
|
||||
|
||||
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.mqtt.api.path.dto.PositionAllChangePointBindingDTO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.positionmap.vo.PositionChangePointBindingPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.positionmap.PositionChangePointBindingDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 区域变更点绑定 Mapper
|
||||
*
|
||||
* @author 陈宾顺
|
||||
*/
|
||||
@Mapper
|
||||
public interface PositionChangePointBindingMapper extends BaseMapperX<PositionChangePointBindingDO> {
|
||||
|
||||
default PageResult<PositionChangePointBindingDO> selectPage(PositionChangePointBindingPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<PositionChangePointBindingDO>()
|
||||
.eqIfPresent(PositionChangePointBindingDO::getStartingPointId, reqVO.getStartingPointId())
|
||||
.eqIfPresent(PositionChangePointBindingDO::getEndPointId, reqVO.getEndPointId())
|
||||
.eqIfPresent(PositionChangePointBindingDO::getStartingPointSortNum, reqVO.getStartingPointSortNum())
|
||||
.eqIfPresent(PositionChangePointBindingDO::getEndPointSortNum, reqVO.getEndPointSortNum())
|
||||
.betweenIfPresent(PositionChangePointBindingDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(PositionChangePointBindingDO::getId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有的区域绑定信息
|
||||
* @return
|
||||
*/
|
||||
List<PositionAllChangePointBindingDTO> getAllPositionChangePointBinding();
|
||||
}
|
@ -60,4 +60,9 @@ public interface PathPlanningService {
|
||||
* 开始同步
|
||||
*/
|
||||
void synchronousStart();
|
||||
|
||||
/**
|
||||
* 发送区域变更点绑定信息
|
||||
*/
|
||||
void sendPositionChangePointBinding();
|
||||
}
|
||||
|
@ -39,6 +39,7 @@ import cn.iocoder.yudao.module.system.enums.item.PositionMapItemEnum;
|
||||
import cn.iocoder.yudao.module.system.enums.line.DirectionEnum;
|
||||
import cn.iocoder.yudao.module.system.enums.path.PathTypeEnum;
|
||||
import cn.iocoder.yudao.module.system.service.config.CommonConfigService;
|
||||
import cn.iocoder.yudao.module.system.service.positionmap.PositionChangePointBindingService;
|
||||
import cn.iocoder.yudao.module.system.service.positionmap.PositionMapItemService;
|
||||
import cn.iocoder.yudao.module.system.service.positionmap.PositionMapService;
|
||||
import cn.iocoder.yudao.module.system.service.robot.RobotInformationService;
|
||||
@ -109,6 +110,9 @@ public class PathPlanningServiceImpl implements PathPlanningService {
|
||||
@Value("${zn.is_simulation:false}")
|
||||
private Boolean isSimulation;
|
||||
|
||||
@Resource
|
||||
private PositionChangePointBindingService positionChangePointBindingService;
|
||||
|
||||
/**
|
||||
* 同步ware_position_map_line的点位信息
|
||||
*/
|
||||
@ -560,6 +564,14 @@ public class PathPlanningServiceImpl implements PathPlanningService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendPositionChangePointBinding() {
|
||||
List<PositionAllChangePointBindingDTO> bindingDTOS = positionChangePointBindingService.getAllPositionChangePointBinding();
|
||||
if (ObjectUtil.isNotEmpty(bindingDTOS)) {
|
||||
commonApi.commonMethod(bindingDTOS, PathPlanningTopicConstant.SYNCHRONOUS_ALL_CHANGE_POINT_BINDING);
|
||||
}
|
||||
}
|
||||
|
||||
public PositionMapLineDTO setPositionMapLineDTOData(PositionMapLineDTO positionMapLineDO) {
|
||||
PositionMapLineDTO build = PositionMapLineDTO.builder()
|
||||
.id(positionMapLineDO.getId())
|
||||
|
@ -0,0 +1,64 @@
|
||||
package cn.iocoder.yudao.module.system.service.positionmap;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
|
||||
import cn.iocoder.yudao.module.mqtt.api.path.dto.PositionAllChangePointBindingDTO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.positionmap.dto.PositionChangePointBindingDTO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.positionmap.vo.PositionChangePointBindingPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.positionmap.vo.PositionChangePointBindingSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.positionmap.PositionChangePointBindingDO;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
/**
|
||||
* 区域变更点绑定 Service 接口
|
||||
*
|
||||
* @author 陈宾顺
|
||||
*/
|
||||
public interface PositionChangePointBindingService extends IService<PositionChangePointBindingDO> {
|
||||
|
||||
/**
|
||||
* 创建区域变更点绑定
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createPositionChangePointBinding(@Valid PositionChangePointBindingSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新区域变更点绑定
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updatePositionChangePointBinding(@Valid PositionChangePointBindingSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除区域变更点绑定
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deletePositionChangePointBinding(Long id);
|
||||
|
||||
/**
|
||||
* 获得区域变更点绑定
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 区域变更点绑定
|
||||
*/
|
||||
PositionChangePointBindingDTO getPositionChangePointBinding(Long id);
|
||||
|
||||
/**
|
||||
* 获得区域变更点绑定分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 区域变更点绑定分页
|
||||
*/
|
||||
PageResult<PositionChangePointBindingDO> getPositionChangePointBindingPage(PositionChangePointBindingPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 查询所有绑定的区域变更点
|
||||
* @return
|
||||
*/
|
||||
List<PositionAllChangePointBindingDTO> getAllPositionChangePointBinding();
|
||||
}
|
@ -0,0 +1,108 @@
|
||||
package cn.iocoder.yudao.module.system.service.positionmap;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.mqtt.api.path.dto.PositionAllChangePointBindingDTO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.positionmap.dto.PositionChangePointBindingDTO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.positionmap.vo.PositionChangePointBindingPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.positionmap.vo.PositionChangePointBindingSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.positionmap.PositionChangePointBindingDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.positionmap.PositionMapDO;
|
||||
import cn.iocoder.yudao.module.system.dal.mysql.positionmap.PositionChangePointBindingMapper;
|
||||
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.*;
|
||||
|
||||
/**
|
||||
* 区域变更点绑定 Service 实现类
|
||||
*
|
||||
* @author 陈宾顺
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class PositionChangePointBindingServiceImpl extends ServiceImpl<PositionChangePointBindingMapper, PositionChangePointBindingDO> implements PositionChangePointBindingService {
|
||||
|
||||
@Resource
|
||||
private PositionChangePointBindingMapper positionChangePointBindingMapper;
|
||||
|
||||
@Override
|
||||
public Long createPositionChangePointBinding(PositionChangePointBindingSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
PositionChangePointBindingDO positionChangePointBinding = BeanUtils.toBean(createReqVO, PositionChangePointBindingDO.class);
|
||||
positionChangePointBindingMapper.insert(positionChangePointBinding);
|
||||
// 返回
|
||||
return positionChangePointBinding.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePositionChangePointBinding(PositionChangePointBindingSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validatePositionChangePointBindingExists(updateReqVO.getId());
|
||||
// 更新
|
||||
PositionChangePointBindingDO updateObj = BeanUtils.toBean(updateReqVO, PositionChangePointBindingDO.class);
|
||||
positionChangePointBindingMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deletePositionChangePointBinding(Long id) {
|
||||
// 校验存在
|
||||
validatePositionChangePointBindingExists(id);
|
||||
// 删除
|
||||
positionChangePointBindingMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validatePositionChangePointBindingExists(Long id) {
|
||||
if (positionChangePointBindingMapper.selectById(id) == null) {
|
||||
throw exception(POSITION_CHANGE_POINT_BINDING_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionChangePointBindingDTO getPositionChangePointBinding(Long mapItemId) {
|
||||
PositionChangePointBindingDTO positionChangePointBinding = new PositionChangePointBindingDTO();
|
||||
PositionChangePointBindingDO position = positionChangePointBindingMapper.selectOne(new LambdaQueryWrapperX<PositionChangePointBindingDO>()
|
||||
.eq(PositionChangePointBindingDO::getStartingPointId, mapItemId));
|
||||
if (ObjectUtil.isNotEmpty(position)) {
|
||||
positionChangePointBinding.setId(position.getId());
|
||||
positionChangePointBinding.setSortNum(position.getEndPointSortNum());
|
||||
positionChangePointBinding.setPointId(position.getEndPointId());
|
||||
return positionChangePointBinding;
|
||||
}
|
||||
|
||||
PositionChangePointBindingDO startPosition = positionChangePointBindingMapper.selectOne(new LambdaQueryWrapperX<PositionChangePointBindingDO>()
|
||||
.eq(PositionChangePointBindingDO::getEndPointId, mapItemId));
|
||||
if (ObjectUtil.isNotEmpty(startPosition)) {
|
||||
positionChangePointBinding.setId(startPosition.getId());
|
||||
positionChangePointBinding.setSortNum(startPosition.getStartingPointSortNum());
|
||||
positionChangePointBinding.setPointId(startPosition.getStartingPointId());
|
||||
}
|
||||
|
||||
return positionChangePointBinding;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<PositionChangePointBindingDO> getPositionChangePointBindingPage(PositionChangePointBindingPageReqVO pageReqVO) {
|
||||
return positionChangePointBindingMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionAllChangePointBindingDTO> getAllPositionChangePointBinding() {
|
||||
return positionChangePointBindingMapper.getAllPositionChangePointBinding();
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -125,4 +125,10 @@ public interface PositionMapItemService extends IService<PositionMapItemDO> {
|
||||
*/
|
||||
Long getUUid();
|
||||
|
||||
/**
|
||||
* 根据排序查询
|
||||
* @param sortNum
|
||||
* @return
|
||||
*/
|
||||
PositionMapItemSaveReqVO getItemBySortNum(Long sortNum);
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.iocoder.yudao.module.system.service.positionmap;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
@ -165,4 +166,15 @@ public class PositionMapItemServiceImpl extends ServiceImpl<PositionMapItemMappe
|
||||
return IdUtil.getSnowflakeNextId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionMapItemSaveReqVO getItemBySortNum(Long sortNum) {
|
||||
PositionMapItemDO positionMapItemDO = positionMapItemMapper.selectOne(new LambdaQueryWrapperX<PositionMapItemDO>()
|
||||
.eq(PositionMapItemDO::getSortNum, sortNum));
|
||||
if (ObjectUtil.isEmpty(positionMapItemDO)) {
|
||||
return null;
|
||||
}
|
||||
PositionMapItemSaveReqVO bean = BeanUtils.toBean(positionMapItemDO, PositionMapItemSaveReqVO.class);
|
||||
return bean;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -208,5 +208,5 @@ zn:
|
||||
open_rate_limiter: true #是否开启限流
|
||||
path_planning:
|
||||
task_chche_time: 1209600 #任务缓存的时间, 默认一星期
|
||||
is_simulation: true # 是否为仿真环境
|
||||
restore_task_restart: true # 恢复任务是否全部重新执行 true:全部重新开始
|
||||
is_simulation: false # 是否为仿真环境
|
||||
restore_task_restart: false # 恢复任务是否全部重新执行 true:全部重新开始
|
||||
|
@ -0,0 +1,22 @@
|
||||
<?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.positionmap.PositionChangePointBindingMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
<select id="getAllPositionChangePointBinding"
|
||||
resultType="cn.iocoder.yudao.module.mqtt.api.path.dto.PositionAllChangePointBindingDTO">
|
||||
select
|
||||
starting_point_id as startingPointId,
|
||||
end_point_id as endPointId
|
||||
from
|
||||
ware_position_change_point_binding
|
||||
where
|
||||
deleted = '0'
|
||||
</select>
|
||||
</mapper>
|
Loading…
Reference in New Issue
Block a user