编辑地图添加检测点

This commit is contained in:
cbs 2025-07-17 09:12:15 +08:00
parent 8c48e8431d
commit e8f37b81a0
12 changed files with 93 additions and 11 deletions

View File

@ -21,7 +21,7 @@ public enum NodeTypeEnum {
PARKING(4, "停车点"),
CHANGE(5, "区域变更点"),
WAIT(6, "等待点"),
TEXT(7, "文字");
CHECK(7, "检测");
/**
* 类型

View File

@ -35,7 +35,7 @@ public class NodeBaseDTO {
@Schema(description = "点位自增排序")
private Long sortNum;
@Schema(description = "类型 1.路径点位 2.库位点 3.充电桩 4.停车点 5.区域变更点 6.等待点 --- 后续补充", example = "1")
@Schema(description = "类型 1.路径点位 2.库位点 3.充电桩 4.停车点 5.区域变更点 6.等待点 7.检测点 --- 后续补充", example = "1")
private Integer type;
@Schema(description = "对应各个类型的独有属性Json格式 例如({库位长度:1,库位宽度:2,库位方向:单向}", example = "1")

View File

@ -37,7 +37,7 @@ public class PositionMapItemPageReqVO extends PageParam {
@Schema(description = "点位自增排序")
private Long sortNum;
@Schema(description = "类型 1.路径点位 2.库位点 3.充电桩 4.停车点 5.区域变更点 6.等待点 --- 后续补充", example = "1")
@Schema(description = "类型 1.路径点位 2.库位点 3.充电桩 4.停车点 5.区域变更点 6.等待点 7.检测点 --- 后续补充", example = "1")
private Integer type;
@Schema(description = "对应各个类型的独有属性Json格式 例如({库位长度:1,库位宽度:2,库位方向:单向}", example = "1")

View File

@ -48,8 +48,8 @@ public class PositionMapItemRespVO {
@Schema(description = "实际坐标y轴")
private String actualLocationY;
@Schema(description = "类型 1.路径点位 2.库位点 3.充电桩 4.停车点 5.区域变更点 6.等待点 --- 后续补充", example = "1")
@ExcelProperty("类型 1.路径点位 2.库位点 3.充电桩 4.停车点 5.区域变更点 6.等待点 --- 后续补充")
@Schema(description = "类型 1.路径点位 2.库位点 3.充电桩 4.停车点 5.区域变更点 6.等待点 7.检测点 --- 后续补充", example = "1")
@ExcelProperty("类型 1.路径点位 2.库位点 3.充电桩 4.停车点 5.区域变更点 6.等待点 7.检测点 --- 后续补充")
private Integer type;
@Schema(description = "点位自增排序")

View File

@ -31,7 +31,7 @@ public class PositionMapItemSaveReqVO {
@Schema(description = "点位自增排序")
private Long sortNum;
@Schema(description = "类型 1.路径点位 2.库位点 3.充电桩 4.停车点 5.区域变更点 6.等待点 --- 后续补充", example = "1")
@Schema(description = "类型 1.路径点位 2.库位点 3.充电桩 4.停车点 5.区域变更点 6.等待点 7.检测点 --- 后续补充", example = "1")
private Integer type;
@Schema(description = "对应各个类型的独有属性Json格式 例如({库位长度:1,库位宽度:2,库位方向:单向}", example = "1")

View File

@ -34,7 +34,7 @@ public class WareHouseTakePointDO extends BaseDO {
*/
private String pointName;
/**
* 点位类型(备用)
* 点位类型 0:翻转机设备, 1:普通取放货点位
*/
private Integer pointType;
/**

View File

@ -61,7 +61,7 @@ public class PositionMapItemDO extends BaseDO {
*/
private Long sortNum;
/**
* 类型 1.路径点位 2.库位点 3.充电桩 4.停车点 5.区域变更点 6.等待点 --- 后续补充
* 类型 1.路径点位 2.库位点 3.充电桩 4.停车点 5.区域变更点 6.等待点 7.检测点--- 后续补充
*/
private Integer type;
/**

View File

@ -11,7 +11,9 @@ public enum PositionMapItemEnum {
CHARGE(3,"充电桩"),
STOP(4,"停车点"),
CHANGE(5,"区域变更点"),
WAIT(6,"等待点");
WAIT(6,"等待点"),
CHECK(7,"检测点");
/**
* 类型
*/

View File

@ -34,6 +34,8 @@ public class NodeProcessingContext {
@Autowired
@Lazy
private DeviceStrategyImpl deviceStrategyImpl;
@Autowired
private CheckStrategyImpl checkStrategyImpl;
/**
* 项目启动时 初始化策略
@ -52,8 +54,8 @@ public class NodeProcessingContext {
strategyMap.put(NodeTypeEnum.CHANGE.getType(), changeNodeStrategyImpl);
// 等待点
strategyMap.put(NodeTypeEnum.WAIT.getType(), mapNodeStrategyImpl);
// 文字
strategyMap.put(NodeTypeEnum.TEXT.getType(), mapNodeStrategyImpl);
// 检测
strategyMap.put(NodeTypeEnum.CHECK.getType(), checkStrategyImpl);
// todo 可以继续添加更多的策略 - 新增实现即可
}

View File

@ -0,0 +1,60 @@
package cn.iocoder.yudao.module.system.handler.mapnode.strategy;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONUtil;
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
import cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.WareHouseTakePointSaveReqVO;
import cn.iocoder.yudao.module.system.controller.admin.positionmap.dto.NodeBaseDTO;
import cn.iocoder.yudao.module.system.dal.dataobject.houselocation.WareHouseTakePointDO;
import cn.iocoder.yudao.module.system.enums.map.PointTypeEnum;
import cn.iocoder.yudao.module.system.service.houselocation.WareHouseTakePointService;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import static com.baomidou.mybatisplus.core.toolkit.IdWorker.getId;
@Component
public class CheckStrategyImpl implements NodeProcessingStrategy{
@Resource
private WareHouseTakePointService houseTakePointService;
@Override
public void processNodes(Long positionMapId, List<NodeBaseDTO> nodeBaseDTOS) {
// -- 策略3 处理设备点
// -- 将data里面的json 数据转为实体类 - 再对比节点id - 然后做新增删除修改操作
List<WareHouseTakePointDO> newList = new ArrayList<>();
// -- 拿到这个地图所绑定的设备 -
WareHouseTakePointSaveReqVO reqVO = new WareHouseTakePointSaveReqVO();
reqVO.setPositionMapId(positionMapId);
reqVO.setPointType(PointTypeEnum.TAKE.getType());
List<WareHouseTakePointDO> oldList = houseTakePointService.getHouseTakePointList(reqVO);
nodeBaseDTOS.forEach(item -> {
if (item.getId() == null) {
item.setId(getId());
}
item.setPositionMapId(positionMapId);
List<WareHouseTakePointDO> wareHouseTakePointDOS = JSONUtil.toList(item.getDataJson(), WareHouseTakePointDO.class);
for (WareHouseTakePointDO wareHouseTakePointDO : wareHouseTakePointDOS) {
wareHouseTakePointDO.setPointType(PointTypeEnum.TAKE.getType());
wareHouseTakePointDO.setPositionMapId(positionMapId);
wareHouseTakePointDO.setPositionMapItemId(item.getId());
newList.add(wareHouseTakePointDO);
}
item.setDataJson(JSONUtil.toJsonStr(wareHouseTakePointDOS));
});
List<List<WareHouseTakePointDO>> list = CollectionUtils.compareLists(oldList, newList,
(oldVal, newVal) -> ObjectUtil.equal(oldVal.getId(), newVal.getId()));
houseTakePointService.batchEditOrDel(list);
}
}

View File

@ -59,4 +59,5 @@ public interface WareHouseTakePointService extends IService<WareHouseTakePointDO
void setTakePointMapIdEmpty(Long mapId,List<Long> ids);
void batchEditOrDel(List<List<WareHouseTakePointDO>> list);
}

View File

@ -4,6 +4,7 @@ import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.WareHouseTakePointPageReqVO;
import cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.WareHouseTakePointSaveReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.houselocation.WareHouseTakePointDO;
import cn.iocoder.yudao.module.system.dal.dataobject.parkingspot.ParkingSpotDO;
import cn.iocoder.yudao.module.system.dal.mysql.houselocation.WareHouseTakePointMapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@ -15,7 +16,9 @@ import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import static cn.hutool.core.collection.CollUtil.isNotEmpty;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.HOUSE_TAKE_POINT_NOT_EXISTS;
/**
@ -88,5 +91,19 @@ public class WareHouseTakePointServiceImpl extends ServiceImpl<WareHouseTakePoin
houseTakePointMapper.setTakePointMapIdEmpty(mapId,ids);
}
@Override
public void batchEditOrDel(List<List<WareHouseTakePointDO>> list) {
//批量添加修改删除
if (isNotEmpty(list.get(0))) {
houseTakePointMapper.insertBatch(list.get(0));
}
if (isNotEmpty(list.get(1))) {
houseTakePointMapper.updateBatch(list.get(1));
}
if (isNotEmpty(list.get(2))) {
houseTakePointMapper.deleteByIds(convertList(list.get(2), WareHouseTakePointDO::getId));
}
}
}