Ver código fonte

:ambulance: 增加注释,增加Redis缓存时间,增加切面,增加mq消息转发

Twelve615 1 ano atrás
pai
commit
962eac0f22

+ 22 - 0
airport/jeecg-boot-module-system/pom.xml

@@ -47,6 +47,28 @@
 <!--            <artifactId>autopoi-web</artifactId>-->
 <!--            <version>1.4.6</version>-->
 <!--        </dependency>-->
+        <dependency>
+            <groupId>com.fasterxml.jackson.core</groupId>
+            <artifactId>jackson-databind</artifactId>
+
+        </dependency>
+        <dependency>
+            <groupId>com.fasterxml.jackson.core</groupId>
+            <artifactId>jackson-core</artifactId>
+
+        </dependency>
+        <dependency>
+            <groupId>com.fasterxml.jackson.core</groupId>
+            <artifactId>jackson-annotations</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.fasterxml.jackson.core</groupId>
+            <artifactId>jackson-databind</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.fasterxml.jackson.dataformat</groupId>
+            <artifactId>jackson-dataformat-xml</artifactId>
+        </dependency>
 
         <dependency>
             <groupId>org.apache.pdfbox</groupId>

+ 84 - 0
airport/jeecg-boot-module-system/src/main/java/org/jeecg/modules/aop/ControllerAspect.java

@@ -0,0 +1,84 @@
+package org.jeecg.modules.aop;
+
+import com.alibaba.fastjson.JSON;
+import lombok.extern.slf4j.Slf4j;
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.Around;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Pointcut;
+import org.jeecg.common.system.util.JwtUtil;
+import org.springframework.messaging.handler.annotation.support.MethodArgumentNotValidException;
+import org.springframework.stereotype.Component;
+import org.springframework.web.context.request.RequestAttributes;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+
+import javax.security.auth.message.AuthException;
+import javax.servlet.http.HttpServletRequest;
+import java.util.Arrays;
+
+/**
+ * @author 王葆权
+ * @Title: 记录全局访问日志
+ * @Package org.jeecg.modules.aop
+ * @Description:
+ * @date 2023/7/17 9:57
+ */
+@Aspect
+@Component
+@Slf4j
+public class ControllerAspect {
+    /**
+     * Controller aspect.
+     */
+    @Pointcut("execution(* org.jeecg.modules.*.controller..*.*(..))")
+    public void controllerAspect() {
+    }
+
+    /**
+     * Around 手动控制调用核心业务逻辑,以及调用前和调用后的处理,
+     * <p>
+     * 注意:当核心业务抛异常后,立即退出,转向AfterAdvice 执行完AfterAdvice,再转到ThrowingAdvice
+     *
+     * @param pjp the pjp
+     * @return object
+     * @throws Throwable the throwable
+     */
+    @Around(value = "controllerAspect()")
+    public Object aroundAdvice(ProceedingJoinPoint pjp) throws Throwable {
+        RequestAttributes ra = RequestContextHolder.getRequestAttributes();
+        ServletRequestAttributes sra = (ServletRequestAttributes) ra;
+        //防止不是http请求的方法,例如:scheduled
+        if (ra == null || sra == null) {
+            return pjp.proceed();
+        }
+        HttpServletRequest request = sra.getRequest();
+
+        String authorization = request.getHeader("Authorization");
+        log.info("AUTHORIZATION:{}", authorization);
+        log.info("USER_NAME:{}", JwtUtil.getUsername(authorization));
+        log.info("URL : " + request.getRequestURL().toString());
+        log.info("HTTP_METHOD : " + request.getMethod());
+        log.info("IP : " + request.getRemoteAddr());
+        log.info("CLASS_METHOD : " + pjp.getSignature().getDeclaringTypeName() + "." + pjp.getSignature().getName());
+        log.info("REQUEST ARGS : " + JSON.toJSONString(pjp.getArgs()));
+
+        long startTime = System.currentTimeMillis();
+        try {
+            Object response = pjp.proceed();
+            // 3.出参打印
+            log.info("RESPONSE:{}", response != null ? JSON.toJSONString(response) : "");
+            return response;
+        } catch (Throwable e) {
+            if (e instanceof MethodArgumentNotValidException) {
+                log.info("RESPONSE ERROR:{}", e.getMessage());
+            } else {
+                log.error("RESPONSE ERROR:{}", Arrays.toString(e.getStackTrace()));
+            }
+            throw e;
+        } finally {
+            long endTime = System.currentTimeMillis();
+            log.info("SPEND TIME : {}ms", (endTime - startTime));
+        }
+    }
+}

+ 36 - 0
airport/jeecg-boot-module-system/src/main/java/org/jeecg/modules/aop/DemoRabbitMqListenerAspect.java

@@ -0,0 +1,36 @@
+package org.jeecg.modules.aop;
+
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.Around;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Pointcut;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author 王葆权
+ * @Title:
+ * @Package org.jeecg.modules.aop
+ * @Description:
+ * @date 2023/7/15 14:40
+ */
+@Aspect
+@Component
+public class DemoRabbitMqListenerAspect {
+
+    /**
+     * 定义切点,拦截所有满足条件的方法
+     */
+    @Pointcut("execution(public * org.jeecg.modules.api.DemoRabbitMqListener3.*(..))")
+    public void point() {
+    }
+
+    @Around("point()")
+    public Object doAround(ProceedingJoinPoint joinPoint) throws Throwable {
+        long start = System.currentTimeMillis();
+        try{
+            return joinPoint.proceed();
+        } finally {
+            System.out.println(joinPoint.getSignature().getName() + ",执行时间: " + (System.currentTimeMillis() - start) + " ms");
+        }
+    }
+}

+ 51 - 20
airport/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/DemoRabbitMqListener3.java

@@ -19,9 +19,12 @@ package org.jeecg.modules.api;
  */
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.rabbitmq.client.Channel;
 import lombok.extern.slf4j.Slf4j;
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.Around;
+import org.aspectj.lang.annotation.Pointcut;
+import org.jeecg.boot.starter.rabbitmq.client.RabbitMqClient;
 import org.jeecg.boot.starter.rabbitmq.core.BaseRabbiMqHandler;
 import org.jeecg.boot.starter.rabbitmq.listenter.MqListener;
 import org.jeecg.common.annotation.RabbitComponent;
@@ -35,22 +38,20 @@ import org.jeecg.modules.admin_order.entity.AdminOrder;
 import org.jeecg.modules.admin_order.service.IAdminOrderService;
 import org.jeecg.modules.admin_security_check.entity.AdminSecurityCheck;
 import org.jeecg.modules.admin_security_check.service.IAdminSecurityCheckService;
-import org.jeecg.modules.admin_user_staff.entity.AdminUserStaff;
+import org.jeecg.modules.utils.ConversionUtil;
 import org.springframework.amqp.core.Message;
-import org.springframework.amqp.rabbit.annotation.RabbitHandler;
 import org.springframework.amqp.rabbit.annotation.RabbitListener;
 import org.springframework.amqp.support.AmqpHeaders;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.annotation.Profile;
 import org.springframework.messaging.handler.annotation.Header;
 import org.w3c.dom.Document;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
 
 import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.transform.OutputKeys;
 import javax.xml.transform.Transformer;
 import javax.xml.transform.TransformerFactory;
@@ -60,7 +61,6 @@ import javax.xml.xpath.XPath;
 import javax.xml.xpath.XPathConstants;
 import javax.xml.xpath.XPathExpression;
 import javax.xml.xpath.XPathFactory;
-import java.io.IOException;
 import java.io.StringReader;
 import java.io.StringWriter;
 import java.nio.charset.StandardCharsets;
@@ -85,7 +85,18 @@ public class DemoRabbitMqListener3 extends BaseRabbiMqHandler<Object> {
     private AdminDfdlMqService adminDfdlMqService;
     @Autowired
     private RedisUtil redisUtil;
+    @Autowired
+    private RabbitMqClient rabbitMqClient;
+
+    @Value("${airport.mq.msgHandlerEvent}")
+    private boolean msgHandlerEvent;
+
+    // 过期时间 7天 单位秒
+    private static final  Long EXPIRATION_TIME = 60480L;
 
+    public DemoRabbitMqListener3(){
+        System.out.println("¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥MQ创建了¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥");
+    }
 
     @RabbitListener(queues = "test")
     public void onMessage(BaseMap baseMap, Channel channel, @Header(AmqpHeaders.DELIVERY_TAG) long deliveryTag) {
@@ -145,12 +156,19 @@ public class DemoRabbitMqListener3 extends BaseRabbiMqHandler<Object> {
     }
 
     //3.0版本
-    //@RabbitListener(queues = "test3")
+    @RabbitListener(queues = "test3")
     public void onMessage3(Message message, Channel channel, @Header(AmqpHeaders.DELIVERY_TAG) long deliveryTag) {
         super.onMessage( message, deliveryTag, channel, new MqListener<Message>() {
             @Override
             public void handler(Message message2, Channel channel) {
                 String xmlString = new String( message2.getBody(), StandardCharsets.UTF_8 );
+
+                if (msgHandlerEvent){
+                    //转发消息到消息总栈测试, 避免本地测试消费消息
+                    BaseMap params = new BaseMap();
+                    params.put("xml", xmlString);
+                    rabbitMqClient.sendMessage("Test3HandlerEvent", params);
+                }
                 // 将XML字符串转换为字符流
                 StringReader sr = new StringReader( xmlString );
                 // 读取XML文档
@@ -163,9 +181,12 @@ public class DemoRabbitMqListener3 extends BaseRabbiMqHandler<Object> {
                     XPath xpath = xPathfactory.newXPath();
                     // 使用XPath表达式获取 节点的值
                     String STYP = (String) xpath.evaluate( "/MSG/META/STYP", doc, XPathConstants.STRING );
-
+                    log.info( "接收到消息,消息类型STYP={},消息数据:",STYP);
+                    log.info("json={}",ConversionUtil.xmlToJson(xmlString));
+                    log.info("XML={}",xmlString);
 //                    航班机位动态信息更新(STLS)
                     if (STYP.equals( "STLS" )) {
+                        log.info("开始处理【STLS】航班机位动态信息更新消息");
                         //航班标识  (航班号)
                         String FFID = (String) xpath.evaluate( "/MSG/DFLT/FFID", doc,
                                 XPathConstants.STRING );
@@ -176,7 +197,7 @@ public class DemoRabbitMqListener3 extends BaseRabbiMqHandler<Object> {
                         String lastChar = FFID.substring( FFID.length() - 1 );
                         //这是过滤掉 D出站的
                         if (lastChar.equals( "A" )) {
-                            log.info( "STLS::" + xmlString );
+                            log.info("执行进站逻辑开始");
                             //机位编号
                             String CODE = (String) xpath.evaluate( "/MSG/DFLT/STLS/STND/CODE", doc,
                                     XPathConstants.STRING );
@@ -227,12 +248,15 @@ public class DemoRabbitMqListener3 extends BaseRabbiMqHandler<Object> {
 //                                one.setType( "使用中" );
                                 adminAircraftPositionService.updateById( one );
                             }
+                            log.info("执行进站逻辑结束");
                         }
+                        log.info("结束处理【STLS】航班机位动态信息更新消息");
                     }
 
                     //航班本站起飞消息(DEPE) 飞机起飞事件
                     if (STYP.equals( "DEPE" )) {
-                        log.info( "DEPE::" + xmlString );
+                        //log.info( "DEPE::" + xmlString );
+                        log.info("开始处理【DEPE】航班本站起飞消息");
                         //航班唯一编号
                         String FLID = (String) xpath.evaluate( "/MSG/DFLT/FLID", doc,
                                 XPathConstants.STRING );
@@ -287,11 +311,12 @@ public class DemoRabbitMqListener3 extends BaseRabbiMqHandler<Object> {
                             }
                         }
 //                        }
+                        log.info("结束处理【DEPE】航班本站起飞消息");
                     }
 
                     //动态航班整表同步事件(DFDL)
                     if (STYP.equals( "DFDL" )) {
-                        log.info( "DFDL::" + xmlString );
+                        log.info("开始处理【DFDL】动态航班整表同步事件消息");
                         redisUtil.set( "DFDL", xmlString );
                         AdminDfdlMq adminDfdlMq = new AdminDfdlMq();
                         adminDfdlMq.setId( "1" );
@@ -313,11 +338,12 @@ public class DemoRabbitMqListener3 extends BaseRabbiMqHandler<Object> {
                                 adminAircraftPositionService.updateById( adminAircraftPosition );
                                 //存入缓存  key为关联航班ID(起飞用)  value为机位id 为后续清除机位存入缓存
 //                            if (!redisUtil.hasKey( adminAircraftPosition.getFlightAfid() )) {
-                                redisUtil.set( adminAircraftPosition.getFlightAfid(), adminAircraftPosition.getId() );
+                                redisUtil.set( adminAircraftPosition.getFlightAfid(), adminAircraftPosition.getId(), EXPIRATION_TIME );
 //                            }
                             }
                             log.info( "同步后::" + adminAircraftPosition.toString() );
                         }
+                        log.info("结束处理【DFDL】动态航班整表同步事件消息");
 
 /*                        XPathExpression expr = xpath.compile( "//DFLT" );
                         NodeList nodes = (NodeList) expr.evaluate( doc, XPathConstants.NODESET );
@@ -432,7 +458,8 @@ public class DemoRabbitMqListener3 extends BaseRabbiMqHandler<Object> {
                     //航班到达本站消息(ARRE)
 
                     if (STYP.equals( "ARRE" )) {
-                        log.info( "ARRE::" + xmlString );
+                        log.info("开始处理【ARRE】航班到达本站消息");
+                        //log.info( "ARRE::" + xmlString );
                         //航班唯一编号
                         String FLID = (String) xpath.evaluate( "/MSG/DFLT/FLID", doc,
                                 XPathConstants.STRING );
@@ -456,10 +483,10 @@ public class DemoRabbitMqListener3 extends BaseRabbiMqHandler<Object> {
                                 String dfdl = (String) redisUtil.get( "DFDL" );
                                 xmldfdl = XMLDFDL( dfdl, FLID );
                             }
-                            //变化
+                            //变化 判断是否有航班变更
                             if (redisUtil.hasKey( "CFCE_" + FLID )) {
                                 String CFCE = (String) redisUtil.get( "CFCE_" + FLID );
-                                log.info( "取变更____CFCE______" + CFCE );
+                                log.info( "有航班变更,取变更____CFCE______" + CFCE );
                                 xmldfdl2 = XMLCFCE( CFCE );
                                 xmldfdl.setAircraftNum( xmldfdl2.getAircraftNum() );
                                 xmldfdl.setFlightNum( xmldfdl2.getFlightNum() );
@@ -477,7 +504,7 @@ public class DemoRabbitMqListener3 extends BaseRabbiMqHandler<Object> {
 //                            }
                             //存入缓存  key为关联航班ID(起飞用)  value为机位id 为后续清除机位存入缓存
 //                            if (!redisUtil.hasKey( xmldfdl.getFlightAfid() )) {
-                                redisUtil.set( xmldfdl.getFlightAfid(), one.getId() );
+                                redisUtil.set( xmldfdl.getFlightAfid(), one.getId(),EXPIRATION_TIME );
 //                            }
                             if (xmldfdl != null) {
                                 one.setAircraftNum( xmldfdl.getAircraftNum() );
@@ -488,6 +515,7 @@ public class DemoRabbitMqListener3 extends BaseRabbiMqHandler<Object> {
                             one.setType( "使用中" );
                             adminAircraftPositionService.updateById( one );
                         }
+                        log.info("结束处理【ARRE】航班到达本站消息");
                     }
 
                     //航班动态信息更新(DFUE)
@@ -504,15 +532,18 @@ public class DemoRabbitMqListener3 extends BaseRabbiMqHandler<Object> {
 
                     //航班更换飞机消息(CFCE)
                     if (STYP.equals( "CFCE" )) {
-                        log.info( "CFCE::" + xmlString );
+                        log.info("开始处理【CFCE】航班更换飞机消息");
+                        //log.info( "CFCE::" + xmlString );
                         //航班唯一编号
                         String FLID = (String) xpath.evaluate( "/MSG/DFLT/FLID", doc,
                                 XPathConstants.STRING );
                         //存入缓存  待落地是取计划里面的数据时变更
 //                        if (!redisUtil.hasKey( "CFCE_" + FLID )) {
                         //
-                            redisUtil.set( "CFCE_" + FLID, xmlString );
+                            redisUtil.set( "CFCE_" + FLID, xmlString, EXPIRATION_TIME );
+                        log.info("存入Redis key: CFCE_{}", FLID);
 //                        }
+                        log.info("结束处理【CFCE】航班更换飞机消息");
                     }
 
                 } catch (Exception e) {
@@ -591,7 +622,7 @@ public class DemoRabbitMqListener3 extends BaseRabbiMqHandler<Object> {
             // 航班唯一编号
 //            String FLID = (String) xpath.evaluate( "/DFLT/FLID", doc2, XPathConstants.STRING );
 //                    关联航班ID   AFID
-//            String AFID = (String) xpath.evaluate( "/MSG/DFLT/AFID", doc, XPathConstants.STRING );
+            String AFID = (String) xpath.evaluate( "/MSG/DFLT/AFID", doc, XPathConstants.STRING );
             //航班标识
             String FFID = (String) xpath.evaluate( "/MSG/DFLT/FFID", doc, XPathConstants.STRING );
             String[] parts = FFID.split( "-" ); // 分割字符串
@@ -601,7 +632,7 @@ public class DemoRabbitMqListener3 extends BaseRabbiMqHandler<Object> {
 
             adminAircraftPosition.setAircraftNum( CFNO );
             adminAircraftPosition.setFlightNum( HBH );
-//            adminAircraftPosition.setFlightAfid( AFID );
+            adminAircraftPosition.setFlightAfid( AFID );
             return adminAircraftPosition;
 
         } catch (Exception e) {

+ 66 - 0
airport/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/Test3BusEvent.java

@@ -0,0 +1,66 @@
+package org.jeecg.modules.api;
+
+import cn.hutool.core.util.ObjectUtil;
+import com.rabbitmq.client.Channel;
+import lombok.SneakyThrows;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.boot.starter.rabbitmq.core.BaseRabbiMqHandler;
+import org.jeecg.boot.starter.rabbitmq.event.EventObj;
+import org.jeecg.boot.starter.rabbitmq.event.JeecgBusEventHandler;
+import org.jeecg.boot.starter.rabbitmq.listenter.MqListener;
+import org.jeecg.common.annotation.RabbitComponent;
+import org.jeecg.common.base.BaseMap;
+import org.jeecg.modules.utils.ConversionUtil;
+import org.springframework.amqp.rabbit.annotation.RabbitListener;
+import org.springframework.amqp.support.AmqpHeaders;
+import org.springframework.context.annotation.Profile;
+import org.springframework.messaging.handler.annotation.Header;
+import org.springframework.stereotype.Component;
+import org.w3c.dom.Document;
+import org.xml.sax.InputSource;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathFactory;
+import java.io.StringReader;
+
+/**
+ * @author 王葆权
+ * @Title: 接收MQ队列中的消息而创建的事件
+ * @Package org.jeecg.modules.api
+ * @Description:
+ * @date 2023/7/15 15:04
+ */
+@Profile("dev")
+@Slf4j
+@RabbitComponent(value = "Test3BusEventListener")
+public class Test3BusEvent extends BaseRabbiMqHandler<Object> {
+
+    public Test3BusEvent() {
+        System.out.println("¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥Test3BusEvent消息总栈事件创建了¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥");
+    }
+
+    @RabbitListener(queues = "Test3HandlerEvent")
+    public void onMessage(BaseMap baseMap, Channel channel, @Header(AmqpHeaders.DELIVERY_TAG) long deliveryTag) {
+        super.onMessage( baseMap, deliveryTag, channel, new MqListener<BaseMap>() {
+            @SneakyThrows
+            @Override
+            public void handler(BaseMap map, Channel channel) {
+                String xml = map.get( "xml" ).toString();
+                // 将XML字符串转换为字符流
+                StringReader sr = new StringReader( xml );
+                XPathFactory xPathfactory = XPathFactory.newInstance();
+                XPath xpath = xPathfactory.newXPath();
+                DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+                Document doc = factory.newDocumentBuilder().parse( new InputSource( sr ) );
+                String STYP = (String) xpath.evaluate( "/MSG/META/STYP", doc, XPathConstants.STRING );
+
+                log.info( "接收到消息,消息类型STYP={},消息数据:",STYP);
+                log.info("json={}", ConversionUtil.xmlToJson(xml));
+                log.info("XML={}",xml);
+            }
+        } );
+    }
+
+}

+ 11 - 0
airport/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/controller/APIController.java

@@ -30,6 +30,7 @@ import org.jeecg.modules.admin_airbridge_test.service.IAdminAirbridgeTestService
 import org.jeecg.modules.admin_aircraft_position.entity.AdminAircraftPosition;
 import org.jeecg.modules.admin_aircraft_position.entity.AdminAircraftPositionR;
 import org.jeecg.modules.admin_aircraft_position.service.IAdminAircraftPositionService;
+import org.jeecg.modules.admin_dfdl_mq.entity.AdminDfdlMq;
 import org.jeecg.modules.admin_edit_message.entity.AdminEditMessage;
 import org.jeecg.modules.admin_edit_message.service.IAdminEditMessageService;
 import org.jeecg.modules.admin_inspection_items.entity.AdminInspectionItems2;
@@ -106,6 +107,16 @@ public class APIController {
     @Autowired
     private IAdminEditMessageService adminEditMessageService;
 
+    @PostMapping(value = "/sredis")
+    public void sredis(@RequestBody String str) {
+        redisUtil.set( "DFDL", str );
+    }
+
+    @GetMapping(value = "/getDfdl")
+    public Result<String>  getDfdl() {
+        Result<String> dfdl = Result.OK((String)redisUtil.get("DFDL"));
+        return dfdl;
+    }
 
     //    STLS
     @PostMapping(value = "/a")

+ 37 - 0
airport/jeecg-boot-module-system/src/main/java/org/jeecg/modules/utils/ConversionUtil.java

@@ -0,0 +1,37 @@
+package org.jeecg.modules.utils;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.dataformat.xml.XmlMapper;
+
+import java.io.IOException;
+
+/**
+ * @author 王葆权
+ * @Title:
+ * @Package org.jeecg.modules.utils
+ * @Description:
+ * @date 2023/7/15 14:23
+ */
+public class ConversionUtil {
+
+    private static XmlMapper XML_MAPPER = new XmlMapper();
+
+    private static ObjectMapper JSON_MAPPER = new ObjectMapper();
+
+    public static ObjectMapper getJsonMapper() {
+        return JSON_MAPPER;
+    }
+
+    public static XmlMapper getXmlMapper() {
+        return XML_MAPPER;
+    }
+
+    public static String xmlToJson(String xml) {
+        try {
+            return getJsonMapper().writeValueAsString(getXmlMapper().readTree(xml));
+        } catch (IOException e) {
+            e.printStackTrace();
+            return "";
+        }
+    }
+}

+ 4 - 0
airport/jeecg-boot-module-system/src/main/resources/application-dev.yml

@@ -20,6 +20,10 @@ management:
       exposure:
         include: metrics,httptrace
 
+airport:
+  mq:
+    msgHandlerEvent: true
+
 spring:
 #  thymeleaf:
 #    cache: false

+ 4 - 0
airport/jeecg-boot-module-system/src/main/resources/application-prod.yml

@@ -20,6 +20,10 @@ management:
       exposure:
         include: metrics,httptrace
 
+airport:
+  mq:
+    msgHandlerEvent: true
+
 spring:
 #  thymeleaf:
 #    cache: false