Browse Source

增加线下版本队列处理v2

xiewenjie 3 years ago
parent
commit
54e5625f2e

+ 2 - 4
sxz-core/src/main/java/com/fdkk/sxz/other/listener/Model3dBuild.java

@@ -13,7 +13,6 @@ import com.fdkk.sxz.webApi.service.IRenovationPartsDetailService;
 import com.fdkk.sxz.webApi.service.custom.ICustomComponentService;
 import com.fdkk.sxz.webApi.service.custom.ICustomProductService;
 import lombok.extern.slf4j.Slf4j;
-import org.slf4j.MDC;
 import org.springframework.amqp.rabbit.annotation.RabbitHandler;
 import org.springframework.amqp.rabbit.annotation.RabbitListener;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -54,7 +53,7 @@ public class Model3dBuild {
     @RabbitListener(queues = TopicRabbitConfig.MODEL_BIZ_3D)
     public void modelBiz3d(Message<RequestQueue> message) {
         Model3dBuild.log.info("modelBiz3d同步消息开始:" + message + ",开始同步");
-        String token = RedisUtil.tryLock("modelBiz3d:" + message.getPayload().getName().toString(), 60 * 60 * 1000);
+        String token = RedisUtil.tryLock("modelBiz3d:" + message.getPayload().getName(), 60 * 60 * 1000);
         try {
             if (token != null) {
                 modelBiz3dHandler(message.getPayload());
@@ -62,9 +61,8 @@ public class Model3dBuild {
         } catch (InterruptedException e) {
             e.printStackTrace();
         } finally {
-            MDC.clear();
             if (token != null) {
-                RedisUtil.unlock(message.getPayload().getTaskId().toString(), token);
+                RedisUtil.unlock("modelBiz3d:" + message.getPayload().getName(), token);
             }
         }
 

+ 2 - 1
sxz-core/src/main/java/com/fdkk/sxz/webApi/controller/QueueController.java

@@ -1,5 +1,6 @@
 package com.fdkk.sxz.webApi.controller;
 
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.fdkk.sxz.annotation.auth.NoAuthentication;
 import com.fdkk.sxz.annotation.log.AroundLog;
@@ -66,6 +67,6 @@ public class QueueController {
         jsonObject.put("name", params.getName());
         jsonObject.put("taskType", "localDataUpload");
         String checkResult = OkHttpUtils.httpPostJson(buildUrl + "check", jsonObject.toJSONString());
-        return Result.success(checkResult);
+        return Result.success("成功", JSON.parse(checkResult));
     }
 }

+ 1 - 1
sxz-modules/src/main/java/com/fdkk/sxz/vo/request/RequestQueue.java

@@ -16,7 +16,7 @@ public class RequestQueue implements Serializable {
 
     private String postfix;
 
-    private Long taskId;
+    private String taskId;
 
 
 }