diff --git a/cmvr-iot-admin/src/main/java/com/cmvr/web/controller/inspection/InspectionWaypointController.java b/cmvr-iot-admin/src/main/java/com/cmvr/web/controller/inspection/InspectionWaypointController.java index d2e23f8..37e09a1 100644 --- a/cmvr-iot-admin/src/main/java/com/cmvr/web/controller/inspection/InspectionWaypointController.java +++ b/cmvr-iot-admin/src/main/java/com/cmvr/web/controller/inspection/InspectionWaypointController.java @@ -111,4 +111,5 @@ public class InspectionWaypointController extends BaseController { return toAjax(inspectionWaypointService.deleteInspectionWaypointByIds(ids)); } + } diff --git a/cmvr-iot-framework/src/main/java/com/cmvr/framework/websocket/handler/BaseChannelSubscribeHandler.java b/cmvr-iot-framework/src/main/java/com/cmvr/framework/websocket/handler/BaseChannelSubscribeHandler.java new file mode 100644 index 0000000..106298e --- /dev/null +++ b/cmvr-iot-framework/src/main/java/com/cmvr/framework/websocket/handler/BaseChannelSubscribeHandler.java @@ -0,0 +1,95 @@ +package com.cmvr.framework.websocket.handler; + +import com.cmvr.framework.websocket.manager.ChannelSubscriptionManager; +import com.cmvr.framework.websocket.message.WSChannelSubscriptionMessage; +import com.cmvr.framework.websocket.service.GrpcClientService; +import lombok.RequiredArgsConstructor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.web.socket.WebSocketSession; + +import java.util.concurrent.CompletableFuture; + +@RequiredArgsConstructor +public abstract class BaseChannelSubscribeHandler implements WSMessageHandler { + + protected final Logger log = LoggerFactory.getLogger(getClass()); + protected final ChannelSubscriptionManager channelSubscriptionManager; + protected final GrpcClientService grpcClientService; + + /** + * 是否需要GRPC远程调用 + * true=格式 service/method/terminalId/deviceId 走grpc + * false=普通频道,只本地订阅,不调用grpc + */ + protected abstract boolean isNeedGrpc(String channel); + + /** + * 解析grpc四个参数 [service,method,terminalId,deviceId] + * 只有isNeedGrpc=true才会进入执行 + */ + protected abstract String[] parseGrpcParam(String channel); + + @Override + public void handle(WebSocketSession session, WSChannelSubscriptionMessage message) throws Exception { + String action = message.getAction(); + String userId = session.getAttributes().get("userId").toString(); + String channel = message.getChannel(); + + switch (action) { + case "subscribe": + doSubscribe(channel, session); + break; + case "unsubscribe": + doUnSubscribe(channel, session); + break; + default: + log.warn("未知订阅动作:{},channel:{}", action, channel); + return; + } + log.info("用户{} {}频道{}", userId, "subscribe".equals(action) ? "订阅" : "取消订阅", channel); + } + + /** 订阅统一模板 */ + private void doSubscribe(String channel, WebSocketSession session) { + boolean needGrpc = isNeedGrpc(channel); + // 没人订阅 + 需要grpc → 发起远端订阅 + if (needGrpc && !channelSubscriptionManager.hasSubscribers(channel)) { + String[] params = parseGrpcParam(channel); + String service = params[0]; + String method = params[1]; + String terminalId = params[2]; + String deviceId = params[3]; + CompletableFuture.runAsync(() -> { + try { + grpcClientService.send(true, terminalId, deviceId, service, method); + } catch (Exception e) { + log.error("频道{} grpc订阅异常", channel, e); + } + }); + } + // 本地统一订阅 + channelSubscriptionManager.subscribe(channel, session); + } + + /** 取消订阅统一模板 */ + private void doUnSubscribe(String channel, WebSocketSession session) { + channelSubscriptionManager.unsubscribe(channel, session); + boolean needGrpc = isNeedGrpc(channel); + // 无任何订阅 + 需要grpc → 远端取消 + if (needGrpc && !channelSubscriptionManager.hasSubscribers(channel)) { + String[] params = parseGrpcParam(channel); + String service = params[0]; + String method = params[1]; + String terminalId = params[2]; + String deviceId = params[3]; + CompletableFuture.runAsync(() -> { + try { + grpcClientService.send(false, terminalId, deviceId, service, method); + } catch (Exception e) { + log.error("频道{} grpc取消订阅异常", channel, e); + } + }); + } + } +} diff --git a/cmvr-iot-framework/src/main/java/com/cmvr/framework/websocket/handler/ChannelSubscriptionMessageHandler.java b/cmvr-iot-framework/src/main/java/com/cmvr/framework/websocket/handler/ChannelSubscriptionMessageHandler.java index a1e2a79..0d675bf 100644 --- a/cmvr-iot-framework/src/main/java/com/cmvr/framework/websocket/handler/ChannelSubscriptionMessageHandler.java +++ b/cmvr-iot-framework/src/main/java/com/cmvr/framework/websocket/handler/ChannelSubscriptionMessageHandler.java @@ -5,67 +5,26 @@ import com.cmvr.framework.websocket.enums.WSMessageTypeEnum; import com.cmvr.framework.websocket.manager.ChannelSubscriptionManager; import com.cmvr.framework.websocket.message.WSChannelSubscriptionMessage; import com.cmvr.framework.websocket.service.GrpcClientService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.socket.WebSocketSession; +import org.springframework.stereotype.Component; -import java.util.concurrent.CompletableFuture; -/** - * 频道订阅消息处理 - */ +@Component @WSMessageType(value = WSMessageTypeEnum.CHANNEL_SUBSCRIPTION, messageClass = WSChannelSubscriptionMessage.class) -public class ChannelSubscriptionMessageHandler implements WSMessageHandler { - private static final Logger log = LoggerFactory.getLogger(ChannelSubscriptionMessageHandler.class); - @Autowired - private ChannelSubscriptionManager channelSubscriptionManager; - @Autowired - private GrpcClientService grpcClientService; - public void handle(WebSocketSession session, WSChannelSubscriptionMessage message) throws Exception { - String action = message.getAction(); - String userId = session.getAttributes().get("userId").toString(); - // service/method/terminalId/deviceId - String channel = message.getChannel(); - String[] channelInfoArr = channel.split("\\/"); - String service = channelInfoArr[0]; - String method = channelInfoArr[1]; - String terminalId = channelInfoArr[2]; - String deviceId = channelInfoArr[3]; - if ("subscribe".equals(action)) { - if (!channelSubscriptionManager.hasSubscribers(channel)) { - // 异步调用gRPC - CompletableFuture.runAsync(() -> { - try { - grpcClientService.send(true, terminalId, deviceId, service, method); - } catch (Exception e) { - log.error("gRPC订阅失败: {}", e.getMessage()); - } - }); - } - channelSubscriptionManager.subscribe(channel, session); - } else if ("unsubscribe".equals(action)) { - channelSubscriptionManager.unsubscribe(channel, session); - if (!channelSubscriptionManager.hasSubscribers(channel)) { - CompletableFuture.runAsync(() -> { - try { - grpcClientService.send(false, terminalId, deviceId, service, method); - } catch (Exception e) { - log.error("gRPC取消订阅失败: {}", e.getMessage()); - } - }); - } - } else { - System.out.println("未知频道操作: " + action); - return; - } +public class ChannelSubscriptionMessageHandler extends BaseChannelSubscribeHandler { - // 统一记录日志 - log.info("用户{} {} 频道{}", userId, getActionDescription(action), channel); + public ChannelSubscriptionMessageHandler(ChannelSubscriptionManager channelSubscriptionManager, GrpcClientService grpcClientService) { + super(channelSubscriptionManager, grpcClientService); } - // 根据动作获取描述文本 - private String getActionDescription(String action) { - return "subscribe".equals(action) ? "订阅了" : "取消订阅了"; + // 当前频道带 / 分段,需要grpc + @Override + protected boolean isNeedGrpc(String channel) { + return channel.contains("/"); } + + @Override + protected String[] parseGrpcParam(String channel) { + return channel.split("/"); + } + } diff --git a/cmvr-iot-framework/src/main/java/com/cmvr/framework/websocket/handler/HeartbeatMessageHandler.java b/cmvr-iot-framework/src/main/java/com/cmvr/framework/websocket/handler/HeartbeatMessageHandler.java index 5320b48..8101c04 100644 --- a/cmvr-iot-framework/src/main/java/com/cmvr/framework/websocket/handler/HeartbeatMessageHandler.java +++ b/cmvr-iot-framework/src/main/java/com/cmvr/framework/websocket/handler/HeartbeatMessageHandler.java @@ -4,12 +4,10 @@ import com.cmvr.framework.websocket.annotation.WSMessageType; import com.cmvr.framework.websocket.enums.WSMessageTypeEnum; import com.cmvr.framework.websocket.message.WSHeartbeatMessage; import org.springframework.web.socket.WebSocketSession; - import java.io.IOException; @WSMessageType(value = WSMessageTypeEnum.HEARTBEAT, messageClass = WSHeartbeatMessage.class) public class HeartbeatMessageHandler implements WSMessageHandler{ - @Override public void handle(WebSocketSession session, WSHeartbeatMessage message) throws IOException { System.out.println("heartbeat"); diff --git a/cmvr-iot-framework/src/main/java/com/cmvr/framework/websocket/handler/SimpleChannelSubscribeHandler.java b/cmvr-iot-framework/src/main/java/com/cmvr/framework/websocket/handler/SimpleChannelSubscribeHandler.java new file mode 100644 index 0000000..e5271ce --- /dev/null +++ b/cmvr-iot-framework/src/main/java/com/cmvr/framework/websocket/handler/SimpleChannelSubscribeHandler.java @@ -0,0 +1,29 @@ +package com.cmvr.framework.websocket.handler; + +import com.cmvr.framework.websocket.annotation.WSMessageType; +import com.cmvr.framework.websocket.enums.WSMessageTypeEnum; +import com.cmvr.framework.websocket.manager.ChannelSubscriptionManager; +import com.cmvr.framework.websocket.message.WSChannelSubscriptionMessage; +import com.cmvr.framework.websocket.service.GrpcClientService; +import org.springframework.stereotype.Component; + +@Component +@WSMessageType(value = WSMessageTypeEnum.CHANNEL_SUBSCRIPTION, messageClass = WSChannelSubscriptionMessage.class) +public class SimpleChannelSubscribeHandler extends BaseChannelSubscribeHandler { + + public SimpleChannelSubscribeHandler(ChannelSubscriptionManager channelSubscriptionManager, GrpcClientService grpcClientService) { + super(channelSubscriptionManager, grpcClientService); + } + + // 简单频道不需要grpc调用 + @Override + protected boolean isNeedGrpc(String channel) { + return false; + } + + // 不会执行到,随便返回 + @Override + protected String[] parseGrpcParam(String channel) { + return new String[0]; + } +} diff --git a/cmvr-iot-inspection/src/main/java/com/cmvr/inspection/domain/InspectionTask.java b/cmvr-iot-inspection/src/main/java/com/cmvr/inspection/domain/InspectionTask.java index f616a49..c7eccde 100644 --- a/cmvr-iot-inspection/src/main/java/com/cmvr/inspection/domain/InspectionTask.java +++ b/cmvr-iot-inspection/src/main/java/com/cmvr/inspection/domain/InspectionTask.java @@ -51,4 +51,8 @@ public class InspectionTask extends BaseEntity @ApiModelProperty("地图id") private String mapId; + @Excel(name = "点位数量") + @ApiModelProperty("点位数量") + private Integer waypointCount; + } diff --git a/cmvr-iot-inspection/src/main/java/com/cmvr/inspection/domain/InspectionTaskInstance.java b/cmvr-iot-inspection/src/main/java/com/cmvr/inspection/domain/InspectionTaskInstance.java index 987b66b..540cfe8 100644 --- a/cmvr-iot-inspection/src/main/java/com/cmvr/inspection/domain/InspectionTaskInstance.java +++ b/cmvr-iot-inspection/src/main/java/com/cmvr/inspection/domain/InspectionTaskInstance.java @@ -54,4 +54,8 @@ public class InspectionTaskInstance extends BaseEntity @ApiModelProperty("检测任务id") private String taskInsId; + @Excel(name = "点位数量") + @ApiModelProperty("点位数量") + private Integer waypointCount; + } diff --git a/cmvr-iot-inspection/src/main/java/com/cmvr/inspection/domain/vo/InspectionTaskInstanceVo.java b/cmvr-iot-inspection/src/main/java/com/cmvr/inspection/domain/vo/InspectionTaskInstanceVo.java index 19422a8..510f331 100644 --- a/cmvr-iot-inspection/src/main/java/com/cmvr/inspection/domain/vo/InspectionTaskInstanceVo.java +++ b/cmvr-iot-inspection/src/main/java/com/cmvr/inspection/domain/vo/InspectionTaskInstanceVo.java @@ -94,4 +94,8 @@ public class InspectionTaskInstanceVo extends BaseEntity @ApiModelProperty("检测任务id") private String taskInsId; + @Excel(name = "点位数量") + @ApiModelProperty("点位数量") + private Integer waypointCount; + } diff --git a/cmvr-iot-inspection/src/main/java/com/cmvr/inspection/domain/vo/InspectionTaskVo.java b/cmvr-iot-inspection/src/main/java/com/cmvr/inspection/domain/vo/InspectionTaskVo.java index 940248c..8bd8054 100644 --- a/cmvr-iot-inspection/src/main/java/com/cmvr/inspection/domain/vo/InspectionTaskVo.java +++ b/cmvr-iot-inspection/src/main/java/com/cmvr/inspection/domain/vo/InspectionTaskVo.java @@ -66,4 +66,8 @@ public class InspectionTaskVo extends BaseEntity @ApiModelProperty("地图名称") private String mapName; + @Excel(name = "点位数量") + @ApiModelProperty("点位数量") + private Integer waypointCount; + } diff --git a/cmvr-iot-inspection/src/main/java/com/cmvr/inspection/listener/InspectionFlowExecutionListener.java b/cmvr-iot-inspection/src/main/java/com/cmvr/inspection/listener/InspectionFlowExecutionListener.java index b459ff2..12cdb41 100644 --- a/cmvr-iot-inspection/src/main/java/com/cmvr/inspection/listener/InspectionFlowExecutionListener.java +++ b/cmvr-iot-inspection/src/main/java/com/cmvr/inspection/listener/InspectionFlowExecutionListener.java @@ -1,6 +1,7 @@ package com.cmvr.inspection.listener; -import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; +import cn.hutool.core.map.MapUtil; +import cn.hutool.core.util.StrUtil; import com.cmvr.common.utils.DateUtils; import com.cmvr.framework.websocket.service.MessagePushService; import com.cmvr.inspection.domain.InspectionTaskInstance; @@ -9,74 +10,144 @@ import com.cmvr.inspection.service.IInspectionTaskInstanceService; import com.cmvr.test.flow.runtime.event.FlowExecutionEvent; import com.cmvr.test.flow.runtime.event.FlowExecutionListener; import lombok.extern.slf4j.Slf4j; -import org.jetbrains.annotations.NotNull; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import java.util.HashMap; -import java.util.Map; +import java.util.*; @Component @Slf4j public class InspectionFlowExecutionListener implements FlowExecutionListener { - @Autowired - private IInspectionTaskInstanceService inspectionTaskInstanceService; - @Autowired - private MessagePushService messagePushService; + private final IInspectionTaskInstanceService inspectionTaskInstanceService; + private final MessagePushService messagePushService; + + /** key:itemId, value:已完成节点集合 */ + private final Map> itemNodeExecutMap = new HashMap<>(); + /** key:taskInsId(流程实例id=taskInsId), value:已执行item集合 */ + private final Map> taskItemExecutMap = new HashMap<>(); + + public InspectionFlowExecutionListener(IInspectionTaskInstanceService inspectionTaskInstanceService, MessagePushService messagePushService) { + this.inspectionTaskInstanceService = inspectionTaskInstanceService; + this.messagePushService = messagePushService; + } + @Override public void onEvent(FlowExecutionEvent event) { - // 节点执行事件 - if (event.getNodeId() != null) { - String info = event.getEventType() == FlowExecutionEvent.EventType.NODE_STARTED ? "开始执行" : "执行完成"; - // 查询巡检任务实例,event中的instId是巡检任务中的taskInsId - InspectionTaskInstance inspectionTaskInstance = inspectionTaskInstanceService.lambdaQuery().eq(InspectionTaskInstance::getTaskInsId, event.getInstId()) - .one(); - String insId = inspectionTaskInstance.getId(); - Map data = new HashMap<>(); - data.put("insId", insId); - data.put("logInfo", info); - try { - messagePushService.pushToChannel("Inspection/TaskInstance", data); - } catch (Exception e) { - log.info("如果没人订阅,则吃掉异常"); - } - + String instId = event.getInstId(); + String itemId = event.getItemId(); + String nodeId = event.getNodeId(); + if (StrUtil.isBlank(instId)) { + return; } - // 通过 instId 找到巡检任务实例,并修改其状态 - // 1.构造更新条件 - LambdaQueryChainWrapper wrapper = inspectionTaskInstanceService.lambdaQuery() - .eq(InspectionTaskInstance::getTaskInsId, event.getInstId()); - // 2.要更新的字段 - InspectionTaskInstance updateEntity = getInspectionTaskInstance(); + + // 1.节点完成才记录当前item下node + if (StrUtil.isNotBlank(itemId) && StrUtil.isNotBlank(nodeId) + && FlowExecutionEvent.EventType.NODE_COMPLETED == event.getEventType()) { + itemNodeExecutMap.computeIfAbsent(itemId, k -> new HashSet<>()).add(nodeId); + } + // 任意事件:当前任务绑定item(item一启动就入Map,所以统计已完成item要-1) + if (StrUtil.isNotBlank(instId) && StrUtil.isNotBlank(itemId)) { + taskItemExecutMap.computeIfAbsent(instId, k -> new HashSet<>()).add(itemId); + } + + InspectionTaskInstance taskInstance = inspectionTaskInstanceService.lambdaQuery() + .eq(InspectionTaskInstance::getTaskInsId, instId) + .one(); + if (taskInstance == null) { + log.warn("未查询到巡检实例,taskInsId:{}", instId); + return; + } + + int targetStatus = TaskStatusEnum.RUNNING.getCode(); + boolean needUpdateDb = false; + Date now = DateUtils.getNowDate(); switch (event.getEventType()) { case TASK_COMPLETED: - // 设置状态为成功 - updateEntity.setStatus(TaskStatusEnum.SUCCESS.getCode()); - // 正确API:update(更新实体, 条件Wrapper) - inspectionTaskInstanceService.update(updateEntity, wrapper.getWrapper()); - + targetStatus = TaskStatusEnum.SUCCESS.getCode(); + needUpdateDb = true; + clearCache(instId); + pushCompleteMsg(taskInstance.getId(), now, targetStatus); break; case TASK_FAILED: - // 设置状态为失败 - updateEntity.setStatus(TaskStatusEnum.FAILED.getCode()); - // 正确API:update(更新实体, 条件Wrapper) - inspectionTaskInstanceService.update(updateEntity, wrapper.getWrapper()); + targetStatus = TaskStatusEnum.FAILED.getCode(); + needUpdateDb = true; + clearCache(instId); break; case NODE_COMPLETED: - // 判断当前任务所有节点是否执行完毕 + default: break; } + + if (needUpdateDb) { + taskInstance.setStatus(targetStatus); + taskInstance.setEndTime(now); + inspectionTaskInstanceService.updateById(taskInstance); + } + + // 节点推送 + if (StrUtil.isNotBlank(nodeId)) { + int waypointCount = taskInstance.getWaypointCount() == null ? 0 : taskInstance.getWaypointCount(); + double progress = 0D; + if (waypointCount > 0) { + // 当前任务已执行item数量(item启动就存入集合,已完整跑完的item=总数-1) + Set itemSet = taskItemExecutMap.getOrDefault(instId, new HashSet<>()); + int itemTotal = itemSet.size(); + int finishedItemNum = itemTotal - 1; + + // 当前item已完成节点数 + Set finishedNodeSet = itemNodeExecutMap.getOrDefault(itemId, new HashSet<>()); + int finishedNode = finishedNodeSet.size(); + int totalNode = event.getNodeCount() == 0 ? 1 : event.getNodeCount(); + + // 已完整跑完点位占比 + double itemTotalRatio = finishedItemNum / (double) waypointCount; + // 当前运行item内部节点占比 + double innerRatio = finishedNode / (double) totalNode / waypointCount; + + // 还原你的兜底:防止循环节点进度超限,最低不低于极小值 + double singleItemBase = 1d / waypointCount; + innerRatio = Math.max(singleItemBase - 0.01, innerRatio); + + progress = (itemTotalRatio + innerRatio) * 100; + } + + String info = event.getEventType() == FlowExecutionEvent.EventType.NODE_STARTED ? "开始执行" : "执行完成"; + Map pushMap = MapUtil.builder() + .put("createTime", now) + .put("insId", taskInstance.getId()) + .put("logInfo", "节点【" + event.getNodeName() + "】" + info) + .put("status", targetStatus) + .put("progress", String.format("%.2f", progress)) + .put("itemId", itemId) + .put("taskId", taskInstance.getTaskId()) + .build(); + try { + messagePushService.pushToChannel("InspectionTaskInstance", pushMap); + } catch (Exception e) { + log.info("消息推送异常,无订阅忽略,itemId:{}", itemId, e); + } + } } - @NotNull - private static InspectionTaskInstance getInspectionTaskInstance() { - InspectionTaskInstance updateEntity = InspectionTaskInstance.builder() - .endTime(DateUtils.getNowDate()) - .build(); - updateEntity.setUpdateTime(DateUtils.getNowDate()); - return updateEntity; + /** 任务结束统一清理缓存 */ + private void clearCache(String taskInsId) { + Set itemList = taskItemExecutMap.getOrDefault(taskInsId, new HashSet<>()); + itemList.forEach(itemNodeExecutMap::remove); + taskItemExecutMap.remove(taskInsId); } - -} - + /** + * 推送完成任务信息(参数dbInsId为数据库主键ID) + */ + public void pushCompleteMsg(String dbInsId, Date now, int targetStatus) { + Map pushMap = MapUtil.builder() + .put("createTime", now) + .put("insId", dbInsId) + .put("status", targetStatus) + .build(); + try { + messagePushService.pushToChannel("InspectionTaskInstance", pushMap); + } catch (Exception e) { + log.info("消息推送异常,无订阅忽略,insId:{}", dbInsId, e); + } + } +} \ No newline at end of file diff --git a/cmvr-iot-inspection/src/main/java/com/cmvr/inspection/mapper/InspectionTaskWaypointMapper.java b/cmvr-iot-inspection/src/main/java/com/cmvr/inspection/mapper/InspectionTaskWaypointMapper.java index bdb97ac..ad1e8e2 100644 --- a/cmvr-iot-inspection/src/main/java/com/cmvr/inspection/mapper/InspectionTaskWaypointMapper.java +++ b/cmvr-iot-inspection/src/main/java/com/cmvr/inspection/mapper/InspectionTaskWaypointMapper.java @@ -50,4 +50,6 @@ public interface InspectionTaskWaypointMapper extends MPJBaseMapper selectInspectionWaypointVoList(InspectionWaypoint inspectionWaypoint); + + } diff --git a/cmvr-iot-inspection/src/main/java/com/cmvr/inspection/service/impl/InspectionTaskInstanceServiceImpl.java b/cmvr-iot-inspection/src/main/java/com/cmvr/inspection/service/impl/InspectionTaskInstanceServiceImpl.java index f07e2b7..5c587cb 100644 --- a/cmvr-iot-inspection/src/main/java/com/cmvr/inspection/service/impl/InspectionTaskInstanceServiceImpl.java +++ b/cmvr-iot-inspection/src/main/java/com/cmvr/inspection/service/impl/InspectionTaskInstanceServiceImpl.java @@ -88,6 +88,9 @@ public class InspectionTaskInstanceServiceImpl extends ServiceImpl waypoints = inspectionTaskWaypointMapper.selectWaypointsByTaskId(taskId); // 同步任务编排 diff --git a/cmvr-iot-inspection/src/main/java/com/cmvr/inspection/service/impl/InspectionWaypointServiceImpl.java b/cmvr-iot-inspection/src/main/java/com/cmvr/inspection/service/impl/InspectionWaypointServiceImpl.java index 7782cff..534b92b 100644 --- a/cmvr-iot-inspection/src/main/java/com/cmvr/inspection/service/impl/InspectionWaypointServiceImpl.java +++ b/cmvr-iot-inspection/src/main/java/com/cmvr/inspection/service/impl/InspectionWaypointServiceImpl.java @@ -2,7 +2,6 @@ package com.cmvr.inspection.service.impl; import java.util.List; import java.util.UUID; - import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.cmvr.inspection.domain.vo.InspectionWaypointVo; import com.cmvr.inspection.mapper.InspectionTaskWaypointMapper; @@ -115,5 +114,4 @@ public class InspectionWaypointServiceImpl extends ServiceImpl + - select id, create_by, create_time, update_by, update_time, remark, task_id, robot_id, status, start_time, end_time, task_ins_id from inspection_task_instance + select id, create_by, create_time, update_by, update_time, remark, task_id, robot_id, status, start_time, end_time, task_ins_id, waypoint_count from inspection_task_instance - select ti.id, ti.create_by, ti.create_time, ti.update_by, ti.update_time, ti.remark, + select ti.id, ti.create_by, ti.create_time, ti.update_by, ti.update_time, ti.remark,ti.waypoint_count, ti.task_id, t.task_name, t.task_code, ti.robot_id, r.robot_name, r.current_map_id as robot_current_map_id, m.map_name, diff --git a/cmvr-iot-inspection/src/main/resources/mapper/inspection/InspectionTaskMapper.xml b/cmvr-iot-inspection/src/main/resources/mapper/inspection/InspectionTaskMapper.xml index 7192c26..5392926 100644 --- a/cmvr-iot-inspection/src/main/resources/mapper/inspection/InspectionTaskMapper.xml +++ b/cmvr-iot-inspection/src/main/resources/mapper/inspection/InspectionTaskMapper.xml @@ -36,7 +36,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select id, create_by, create_time, update_by, update_time, remark, task_code, task_name, task_type, task_config_id, map_id from inspection_task + select id, create_by, create_time, update_by, update_time, remark, task_code, task_name, task_type, task_config_id, map_id, waypoint_count from inspection_task select t.id, t.create_by, t.create_time, t.update_by, t.update_time, t.remark, - t.task_code, t.task_name, t.task_type, t.task_config_id, t.map_id, + t.task_code, t.task_name, t.task_type, t.task_config_id, t.map_id, t.waypoint_count, m.map_name, u1.user_name as create_by_name, u2.user_name as update_by_name from inspection_task t diff --git a/cmvr-iot-inspection/src/main/resources/mapper/inspection/InspectionWaypointMapper.xml b/cmvr-iot-inspection/src/main/resources/mapper/inspection/InspectionWaypointMapper.xml index f518bcf..0a4d770 100644 --- a/cmvr-iot-inspection/src/main/resources/mapper/inspection/InspectionWaypointMapper.xml +++ b/cmvr-iot-inspection/src/main/resources/mapper/inspection/InspectionWaypointMapper.xml @@ -40,14 +40,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select id, create_by, create_time, update_by, update_time, remark, waypoint_name, enabled, sort_order, detect_item_id, map_id from inspection_waypoint - -