Prechádzať zdrojové kódy

使用新的方式监听mq的q

houweiyu 5 rokov pred
rodič
commit
977c1112ab

+ 3 - 0
fdkanfang-application/src/main/resources/application-dev.properties

@@ -81,3 +81,6 @@ spring.rabbitmq.password=guest
 #ËÄά¿´¿´µÄµÇ¼ÓòÃû
 4dkankan.host=https://test.4dkankan.com/
 
+#queue
+verticle.queue=verticalQueue
+

+ 4 - 1
fdkanfang-application/src/main/resources/application-sit.properties

@@ -65,4 +65,7 @@ logging.level.com.fdkanfang=debug
 
 
 #ËÄά¿´¿´µÄµÇ¼ÓòÃû
-4dkankan.host=https://4dkankan.com/
+4dkankan.host=https://4dkankan.com/
+
+#queue
+verticle.queue=verticalQueue

+ 4 - 4
fdkanfang-web/src/main/java/com/fdkanfang/web/mq/listener/VerticalListener.java

@@ -9,14 +9,12 @@ import com.fdkanfang.common.util.AliyunOssUtil;
 import com.fdkanfang.common.util.CreateObjUtil;
 import com.fdkanfang.domain.backend.HouseEntity;
 import com.fdkanfang.service.backend.HouseService2;
-import com.fdkanfang.web.mq.config.RabbitConfig;
 import lombok.extern.log4j.Log4j2;
-import org.hibernate.boot.spi.InFlightMetadataCollector;
 import org.springframework.amqp.rabbit.annotation.RabbitHandler;
 import org.springframework.amqp.rabbit.annotation.RabbitListener;
+import org.springframework.amqp.support.postprocessor.MessagePostProcessorUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
-import org.springframework.transaction.annotation.Transactional;
 
 import java.util.Date;
 import java.util.HashMap;
@@ -26,9 +24,11 @@ import java.util.HashMap;
  *
  * 垂直校验消息监听
  */
+
 @Log4j2
 @Component
-@RabbitListener(queues = RabbitConfig.VERTICAL_QUEUE) // 指定监听队列
+//@RabbitListener(queues = RabbitConfig.VERTICAL_QUEUE) // 指定监听队列
+@RabbitListener(queues = "${verticle.queue}") // 指定监听队列
 public class VerticalListener {
 
     @Autowired

+ 2 - 2
fdkanfang-web/src/main/java/com/fdkanfang/web/shiro/MyRealm.java

@@ -139,10 +139,10 @@ public class MyRealm extends AuthorizingRealm {
             if(res.containsKey("code")){
                 code = (int) res.get("code");
                 if(code != 0){
-                    throw new JwtAuthenticationException(ResultCodeEnum.D3002.getCode() , ResultCodeEnum.D3002.getDesc());
+                    throw new JwtAuthenticationException(ResultCodeEnum.D3002.getCode() , "账户登录已过期,请重新登录");
                 }
             }else{
-                throw new JwtAuthenticationException(ResultCodeEnum.D3002.getCode() , ResultCodeEnum.D3002.getDesc());
+                throw new JwtAuthenticationException(ResultCodeEnum.D3002.getCode() , "账户登录已过期,请重新登录");
             }
         }
         log.info("验证token完成");