|
@@ -1,7 +1,9 @@
|
|
|
package com.github.zuihou.business.mq;
|
|
|
|
|
|
+import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.github.zuihou.business.DemoLine.DemoCacheKey;
|
|
|
import com.github.zuihou.business.DemoLine.DemoLineConstant;
|
|
|
import com.github.zuihou.business.DemoLine.YunjianConstant;
|
|
@@ -32,6 +34,7 @@ import com.github.zuihou.business.productionResourceCenter.service.impl.AGVNodeS
|
|
|
import com.github.zuihou.business.productionResourceCenter.service.impl.MachineNodeServiceImpl;
|
|
|
import com.github.zuihou.business.productionResourceCenter.service.impl.OtherNodeServiceImpl;
|
|
|
import com.github.zuihou.business.productionResourceCenter.service.impl.RobotNodeServiceImpl;
|
|
|
+import com.github.zuihou.business.util.DynamicRabbitMq;
|
|
|
import com.github.zuihou.business.util.MsgUtil;
|
|
|
import com.github.zuihou.common.constant.BizConstant;
|
|
|
import com.github.zuihou.common.constant.CacheKey;
|
|
@@ -149,24 +152,39 @@ public class TaskWorkNode {
|
|
|
|
|
|
private final String fileName = "";
|
|
|
|
|
|
- public void updateTaskStatusJob(String data) throws InterruptedException {
|
|
|
+ public void updateTaskStatusJob(String data, String consumerQueue) throws InterruptedException {
|
|
|
JSONObject jsonObject = JSONObject.parseObject(data);
|
|
|
System.out.println("返回请求数据: " + data);
|
|
|
String taskNodeId = jsonObject.getString("taskNodeId");
|
|
|
//业务类型-1、是普通的节点类型,2-是线边库轮询
|
|
|
String bizType = jsonObject.getString("bizType");
|
|
|
String handMode = jsonObject.getString("handMode");
|
|
|
-
|
|
|
//多产品搬运类型
|
|
|
String carryType = jsonObject.getString("carryType");
|
|
|
- if (StringUtil.isEmpty(taskNodeId) || StringUtil.isEmpty(bizType)) {
|
|
|
+
|
|
|
+ BaseContextHandler.setTenant("0000");
|
|
|
+ String queueName = "device.queue."+ BizConstant.MQ_GLOBAL_EXCEPTION;
|
|
|
+
|
|
|
+ if (consumerQueue.equals(queueName)) {
|
|
|
AAutoNodeLog log = AAutoNodeLog.builder().build();
|
|
|
- log.setExeResult("0").setManual("1").setFeedback("全局异常处理");
|
|
|
- autoNodeLogService.save(log);
|
|
|
- throw new RuntimeException("全局通知异常");
|
|
|
+ StringBuilder buffer = new StringBuilder();
|
|
|
+ buffer.append(jsonObject.getString("Line")).append("-设备(").append(jsonObject.getString("Name")+")").append(jsonObject.getString("Status"));
|
|
|
+ log.setExeResult("0").setManual("1").setFeedback("全局异常:"+ buffer.toString()).setStartTime(new Date()).setExecuteTime(new Date());
|
|
|
+ LbqWrapper<AAutoNodeLog> lbqWrapper = new LbqWrapper<AAutoNodeLog>();
|
|
|
+ lbqWrapper.eq(AAutoNodeLog::getExeResult, log.getExeResult()).eq(AAutoNodeLog::getManual, log.getManual()).eq(AAutoNodeLog::getStatus, 0).eq(AAutoNodeLog::getFeedback, log.getFeedback());
|
|
|
+ //判断全局异常是否已存在
|
|
|
+ AAutoNodeLog exist = autoNodeLogService.getOne(lbqWrapper);
|
|
|
+ if(null == exist){
|
|
|
+ autoNodeLogService.save(log);
|
|
|
+ }else{
|
|
|
+ //更新执行时间
|
|
|
+ exist.setExecuteTime(new Date());
|
|
|
+ autoNodeLogService.updateAllById(exist);
|
|
|
+ }
|
|
|
+ //throw new RuntimeException("全局通知异常");
|
|
|
+ return;
|
|
|
}
|
|
|
logger.info("=======================" + taskNodeId);
|
|
|
- BaseContextHandler.setTenant("0000");
|
|
|
|
|
|
TaskNode taskNode = taskNodeService.getById(taskNodeId);
|
|
|
//
|