Browse Source

:sparkles: 机位接收消息代码重构

Twelve615 1 year ago
parent
commit
2f164d5f6e
25 changed files with 1898 additions and 9 deletions
  1. 167 0
      airport/jeecg-boot-module-system/src/main/java/org/jeecg/modules/admin_dfdl_list/controller/AdminDfdlListController.java
  2. 117 0
      airport/jeecg-boot-module-system/src/main/java/org/jeecg/modules/admin_dfdl_list/entity/AdminDfdlList.java
  3. 17 0
      airport/jeecg-boot-module-system/src/main/java/org/jeecg/modules/admin_dfdl_list/mapper/AdminDfdlListMapper.java
  4. 5 0
      airport/jeecg-boot-module-system/src/main/java/org/jeecg/modules/admin_dfdl_list/mapper/xml/AdminDfdlListMapper.xml
  5. 14 0
      airport/jeecg-boot-module-system/src/main/java/org/jeecg/modules/admin_dfdl_list/service/IAdminDfdlListService.java
  6. 19 0
      airport/jeecg-boot-module-system/src/main/java/org/jeecg/modules/admin_dfdl_list/service/impl/AdminDfdlListServiceImpl.java
  7. 5 5
      airport/jeecg-boot-module-system/src/main/java/org/jeecg/modules/aop/ControllerAspect.java
  8. 3 3
      airport/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/DemoRabbitMqListener3.java
  9. 164 0
      airport/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/imf/ImfMqListener.java
  10. 45 0
      airport/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/imf/msg/ArreImfMsg.java
  11. 58 0
      airport/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/imf/msg/CfceImfMsg.java
  12. 89 0
      airport/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/imf/msg/DepeImfMsg.java
  13. 42 0
      airport/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/imf/msg/DfdeImfMsg.java
  14. 116 0
      airport/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/imf/msg/DfdlImfMsg.java
  15. 40 0
      airport/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/imf/msg/DfieImfMsg.java
  16. 62 0
      airport/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/imf/msg/HbttImfMsg.java
  17. 29 0
      airport/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/imf/msg/ImfMsg.java
  18. 391 0
      airport/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/imf/msg/ImfMsgAbstract.java
  19. 28 0
      airport/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/imf/msg/ImfMsgHeader.java
  20. 54 0
      airport/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/imf/msg/ImfMsgOperation.java
  21. 37 0
      airport/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/imf/msg/ImfMsgType.java
  22. 61 0
      airport/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/imf/msg/ImfMsgUtil.java
  23. 293 0
      airport/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/imf/msg/StlsImfMsg.java
  24. 41 0
      airport/jeecg-boot-module-system/src/main/java/org/jeecg/modules/utils/ConversionUtil.java
  25. 1 1
      airport/jeecg-boot-module-system/src/main/resources/jeecg/jeecg_config.properties

+ 167 - 0
airport/jeecg-boot-module-system/src/main/java/org/jeecg/modules/admin_dfdl_list/controller/AdminDfdlListController.java

@@ -0,0 +1,167 @@
+package org.jeecg.modules.admin_dfdl_list.controller;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.aspect.annotation.AutoLog;
+import org.jeecg.common.util.oConvertUtils;
+import org.jeecg.modules.admin_dfdl_list.entity.AdminDfdlList;
+import org.jeecg.modules.admin_dfdl_list.service.IAdminDfdlListService;
+import java.util.Date;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.system.base.controller.JeecgController;
+import org.jeecgframework.poi.excel.ExcelImportUtil;
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
+import org.jeecgframework.poi.excel.entity.ExportParams;
+import org.jeecgframework.poi.excel.entity.ImportParams;
+import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import org.springframework.web.servlet.ModelAndView;
+import com.alibaba.fastjson.JSON;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
+ /**
+ * @Description: 计划列表
+ * @Author: jeecg-boot
+ * @Date:   2023-07-19
+ * @Version: V1.0
+ */
+@Slf4j
+@Api(tags="计划列表")
+@RestController
+@RequestMapping("/admin_dfdl_list/adminDfdlList")
+public class AdminDfdlListController extends JeecgController<AdminDfdlList, IAdminDfdlListService> {
+	@Autowired
+	private IAdminDfdlListService adminDfdlListService;
+	
+	/**
+	 * 分页列表查询
+	 *
+	 * @param adminDfdlList
+	 * @param pageNo
+	 * @param pageSize
+	 * @param req
+	 * @return
+	 */
+	@AutoLog(value = "计划列表-分页列表查询")
+	@ApiOperation(value="计划列表-分页列表查询", notes="计划列表-分页列表查询")
+	@GetMapping(value = "/list")
+	public Result<?> queryPageList(AdminDfdlList adminDfdlList,
+								   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+								   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+								   HttpServletRequest req) {
+		QueryWrapper<AdminDfdlList> queryWrapper = QueryGenerator.initQueryWrapper(adminDfdlList, req.getParameterMap());
+		Page<AdminDfdlList> page = new Page<AdminDfdlList>(pageNo, pageSize);
+		IPage<AdminDfdlList> pageList = adminDfdlListService.page(page, queryWrapper);
+		return Result.OK(pageList);
+	}
+	
+	/**
+	 * 添加
+	 *
+	 * @param adminDfdlList
+	 * @return
+	 */
+	@AutoLog(value = "计划列表-添加")
+	@ApiOperation(value="计划列表-添加", notes="计划列表-添加")
+	@PostMapping(value = "/add")
+	public Result<?> add(@RequestBody AdminDfdlList adminDfdlList) {
+		adminDfdlListService.save(adminDfdlList);
+		return Result.OK("添加成功!");
+	}
+	
+	/**
+	 * 编辑
+	 *
+	 * @param adminDfdlList
+	 * @return
+	 */
+	@AutoLog(value = "计划列表-编辑")
+	@ApiOperation(value="计划列表-编辑", notes="计划列表-编辑")
+	@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
+	public Result<?> edit(@RequestBody AdminDfdlList adminDfdlList) {
+		adminDfdlListService.updateById(adminDfdlList);
+		return Result.OK("编辑成功!");
+	}
+	
+	/**
+	 * 通过id删除
+	 *
+	 * @param id
+	 * @return
+	 */
+	@AutoLog(value = "计划列表-通过id删除")
+	@ApiOperation(value="计划列表-通过id删除", notes="计划列表-通过id删除")
+	@DeleteMapping(value = "/delete")
+	public Result<?> delete(@RequestParam(name="id",required=true) String id) {
+		adminDfdlListService.removeById(id);
+		return Result.OK("删除成功!");
+	}
+	
+	/**
+	 * 批量删除
+	 *
+	 * @param ids
+	 * @return
+	 */
+	@AutoLog(value = "计划列表-批量删除")
+	@ApiOperation(value="计划列表-批量删除", notes="计划列表-批量删除")
+	@DeleteMapping(value = "/deleteBatch")
+	public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
+		this.adminDfdlListService.removeByIds(Arrays.asList(ids.split(",")));
+		return Result.OK("批量删除成功!");
+	}
+	
+	/**
+	 * 通过id查询
+	 *
+	 * @param id
+	 * @return
+	 */
+	@AutoLog(value = "计划列表-通过id查询")
+	@ApiOperation(value="计划列表-通过id查询", notes="计划列表-通过id查询")
+	@GetMapping(value = "/queryById")
+	public Result<?> queryById(@RequestParam(name="id",required=true) String id) {
+		AdminDfdlList adminDfdlList = adminDfdlListService.getById(id);
+		return Result.OK(adminDfdlList);
+	}
+
+  /**
+   * 导出excel
+   *
+   * @param request
+   * @param adminDfdlList
+   */
+  @RequestMapping(value = "/exportXls")
+  public ModelAndView exportXls(HttpServletRequest request, AdminDfdlList adminDfdlList) {
+      return super.exportXls(request, adminDfdlList, AdminDfdlList.class, "计划列表");
+  }
+
+  /**
+   * 通过excel导入数据
+   *
+   * @param request
+   * @param response
+   * @return
+   */
+  @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+  public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+      return super.importExcel(request, response, AdminDfdlList.class);
+  }
+
+}

+ 117 - 0
airport/jeecg-boot-module-system/src/main/java/org/jeecg/modules/admin_dfdl_list/entity/AdminDfdlList.java

@@ -0,0 +1,117 @@
+package org.jeecg.modules.admin_dfdl_list.entity;
+
+import java.io.Serializable;
+import java.util.Date;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.format.annotation.DateTimeFormat;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+/**
+ * @Description: 计划列表
+ * @Author: jeecg-boot
+ * @Date:   2023-07-19
+ * @Version: V1.0
+ */
+@Data
+@TableName("admin_dfdl_list")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value="admin_dfdl_list对象", description="计划列表")
+public class AdminDfdlList {
+    
+	/**航班唯一id*/
+	@Excel(name = "航班唯一id", width = 15)
+    @ApiModelProperty(value = "航班唯一id")
+	@TableId(value = "flid", type=IdType.NONE)
+	private java.lang.Integer flid;
+	/**关联航班唯一id*/
+	@Excel(name = "关联航班唯一id", width = 15)
+    @ApiModelProperty(value = "关联航班唯一id")
+	private java.lang.Integer afid;
+	/**航班唯一编号*/
+	@Excel(name = "航班唯一编号", width = 15)
+    @ApiModelProperty(value = "航班唯一编号")
+	private java.lang.String ffid;
+	/**航空公司二字码*/
+	@Excel(name = "航空公司二字码", width = 15)
+    @ApiModelProperty(value = "航空公司二字码")
+	private java.lang.String awcd;
+	/**航班号*/
+	@Excel(name = "航班号", width = 15)
+    @ApiModelProperty(value = "航班号")
+	private java.lang.String flno;
+	/**飞机号*/
+	@Excel(name = "飞机号", width = 15)
+	@ApiModelProperty(value = "飞机号")
+	private java.lang.String cfno;
+	/**航班执行日期;进港航班的计划降落时间里面的日期,出港航班的计划起飞时间里面的日期*/
+	@Excel(name = "航班执行日期;进港航班的计划降落时间里面的日期,出港航班的计划起飞时间里面的日期", width = 15)
+    @ApiModelProperty(value = "航班执行日期;进港航班的计划降落时间里面的日期,出港航班的计划起飞时间里面的日期")
+	private java.lang.String fexd;
+	/**航班进出标志;A-进港;D-出港*/
+	@Excel(name = "航班进出标志;A-进港;D-出港", width = 15)
+    @ApiModelProperty(value = "航班进出标志;A-进港;D-出港")
+	private java.lang.String flio;
+	/**航班任务;W/Z(正班)*/
+	@Excel(name = "航班任务;W/Z(正班)", width = 15)
+    @ApiModelProperty(value = "航班任务;W/Z(正班)")
+	private java.lang.String fltk;
+	/**航班属性;2403 国内,2401 国际,2404 混合,2402 地区
+*/
+	@Excel(name = "航班属性;2403 国内,2401 国际,2404 混合,2402 地区", width = 15)
+    @ApiModelProperty(value = "航班属性;2403 国内,2401 国际,2404 混合,2402 地区")
+	private java.lang.String fatt;
+	/**预计开始使用时间*/
+	@Excel(name = "预计开始使用时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "预计开始使用时间")
+	private java.util.Date estr;
+	/**预计结束使用时间*/
+	@Excel(name = "预计结束使用时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "预计结束使用时间")
+	private java.util.Date eend;
+	/**实际开始使用时间*/
+	@Excel(name = "实际开始使用时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "实际开始使用时间")
+	private java.util.Date rstr;
+	/**实际结束使用时间*/
+	@Excel(name = "实际结束使用时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "实际结束使用时间")
+	private java.util.Date rend;
+	/**是否到达(业务自定义);0:未到达,1:到达*/
+	@Excel(name = "是否到达(业务自定义);0:未到达,1:到达", width = 15)
+    @ApiModelProperty(value = "是否到达(业务自定义);0:未到达,1:到达")
+	private java.lang.Integer arrival;
+	/**updateTime*/
+	@Excel(name = "updateTime", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "updateTime")
+	private java.util.Date updateTime;
+	/**createTime*/
+	@Excel(name = "createTime", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "createTime")
+	private java.util.Date createTime;
+	/**是否删除(业务自定义):0:未删除,1:删除*/
+	@Excel(name = "是否删除(业务自定义):0:未删除,1:删除", width = 15)
+    @ApiModelProperty(value = "是否删除(业务自定义):0:未删除,1:删除")
+	private java.lang.Integer del;
+}

+ 17 - 0
airport/jeecg-boot-module-system/src/main/java/org/jeecg/modules/admin_dfdl_list/mapper/AdminDfdlListMapper.java

@@ -0,0 +1,17 @@
+package org.jeecg.modules.admin_dfdl_list.mapper;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Param;
+import org.jeecg.modules.admin_dfdl_list.entity.AdminDfdlList;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * @Description: 计划列表
+ * @Author: jeecg-boot
+ * @Date:   2023-07-19
+ * @Version: V1.0
+ */
+public interface AdminDfdlListMapper extends BaseMapper<AdminDfdlList> {
+
+}

+ 5 - 0
airport/jeecg-boot-module-system/src/main/java/org/jeecg/modules/admin_dfdl_list/mapper/xml/AdminDfdlListMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.jeecg.modules.admin_dfdl_list.mapper.AdminDfdlListMapper">
+
+</mapper>

+ 14 - 0
airport/jeecg-boot-module-system/src/main/java/org/jeecg/modules/admin_dfdl_list/service/IAdminDfdlListService.java

@@ -0,0 +1,14 @@
+package org.jeecg.modules.admin_dfdl_list.service;
+
+import org.jeecg.modules.admin_dfdl_list.entity.AdminDfdlList;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * @Description: 计划列表
+ * @Author: jeecg-boot
+ * @Date:   2023-07-19
+ * @Version: V1.0
+ */
+public interface IAdminDfdlListService extends IService<AdminDfdlList> {
+
+}

+ 19 - 0
airport/jeecg-boot-module-system/src/main/java/org/jeecg/modules/admin_dfdl_list/service/impl/AdminDfdlListServiceImpl.java

@@ -0,0 +1,19 @@
+package org.jeecg.modules.admin_dfdl_list.service.impl;
+
+import org.jeecg.modules.admin_dfdl_list.entity.AdminDfdlList;
+import org.jeecg.modules.admin_dfdl_list.mapper.AdminDfdlListMapper;
+import org.jeecg.modules.admin_dfdl_list.service.IAdminDfdlListService;
+import org.springframework.stereotype.Service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+/**
+ * @Description: 计划列表
+ * @Author: jeecg-boot
+ * @Date:   2023-07-19
+ * @Version: V1.0
+ */
+@Service
+public class AdminDfdlListServiceImpl extends ServiceImpl<AdminDfdlListMapper, AdminDfdlList> implements IAdminDfdlListService {
+
+}

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

@@ -54,20 +54,20 @@ public class ControllerAspect {
         }
         HttpServletRequest request = sra.getRequest();
 
-        String authorization = request.getHeader("Authorization");
-        log.info("AUTHORIZATION:{}", authorization);
-        log.info("USER_NAME:{}", JwtUtil.getUsername(authorization));
+        //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()));
+        //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) : "");
+            //log.info("RESPONSE:{}", response != null ? JSON.toJSONString(response) : "");
             return response;
         } catch (Throwable e) {
             if (e instanceof MethodArgumentNotValidException) {

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

@@ -77,8 +77,8 @@ import static org.bouncycastle.crypto.tls.ConnectionEnd.client;
  * FIXME: 当前版本耦合严重,后期需要再次封装
  */
 @Slf4j
-@Profile("prod")
-@RabbitComponent(value = "testListener")
+//@Profile("prod")
+//@RabbitComponent(value = "testListener")
 public class DemoRabbitMqListener3 extends BaseRabbiMqHandler<Object> {
     @Autowired
     private IAdminAircraftPositionService adminAircraftPositionService;
@@ -104,7 +104,7 @@ 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

File diff suppressed because it is too large
+ 164 - 0
airport/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/imf/ImfMqListener.java


+ 45 - 0
airport/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/imf/msg/ArreImfMsg.java

@@ -0,0 +1,45 @@
+package org.jeecg.modules.api.imf.msg;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import org.jeecg.modules.admin_aircraft_position.entity.AdminAircraftPosition;
+import org.jeecg.modules.admin_dfdl_list.entity.AdminDfdlList;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.Date;
+
+/**
+ * @author 王葆权
+ * @Title: 航班到达本站消息
+ * @Package org.jeecg.modules.api.imf.msg
+ * @Description:
+ * @date 2023/7/20 10:28
+ */
+public class ArreImfMsg extends ImfMsgAbstract {
+    public ArreImfMsg(String xmlStr) {
+        super(xmlStr, ImfMsgType.ARRE);
+    }
+
+    @Override
+    @Transactional
+    public void handle() {
+        // 直接更新机位表将计划表以及消息中的时间等数据更新
+        String FLID = getStrVal("/MSG/DFLT/FLID");
+        // 实际到达时间 20230619112000
+        String FRLT = getStrVal("/MSG/DFLT/FRLT");
+        Date date = strToDate(FRLT);
+        LambdaQueryWrapper<AdminAircraftPosition> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(AdminAircraftPosition::getFlightSole, FLID);
+        AdminAircraftPosition adminAircraftPosition = getAdminAircraftPositionService().getOne(queryWrapper);
+        if (adminAircraftPosition != null) {
+            // 找到对应机位 更新数据
+            adminAircraftPosition.setDropTime(date);
+            adminAircraftPosition.setType("使用中");
+            AdminDfdlList adminDfdlList = getAdminDfdlListService().getById(FLID);
+            adminDfdlCopyToAirPosition(adminDfdlList, adminAircraftPosition);
+            getAdminAircraftPositionService().updateById(adminAircraftPosition);
+            // 更新计划表 设置已到达
+            adminDfdlList.setArrival(1);
+            updateAdminDfdl(adminDfdlList);
+        }
+    }
+}

+ 58 - 0
airport/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/imf/msg/CfceImfMsg.java

@@ -0,0 +1,58 @@
+package org.jeecg.modules.api.imf.msg;
+
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import org.jeecg.modules.admin_aircraft_position.entity.AdminAircraftPosition;
+import org.jeecg.modules.admin_dfdl_list.entity.AdminDfdlList;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.xml.xpath.XPath;
+
+/**
+ * @author 王葆权
+ * @Title: 处理航班更换信息
+ * @Package org.jeecg.modules.api.imf.msg
+ * @Description:
+ * @date 2023/7/19 18:32
+ */
+public class CfceImfMsg extends ImfMsgAbstract {
+
+    public CfceImfMsg(String xmlStr) {
+        super(xmlStr, ImfMsgType.CFCE);
+    }
+
+    @Override
+    @Transactional
+    public void handle() {
+        // 更换计划表中的航班
+        AdminDfdlList entity = new AdminDfdlList();
+        String flid = getStrVal("/MSG/DFLT/FLID");
+        entity.setFlid(Integer.valueOf(flid));
+
+        String ffid = getStrVal("/MSG/DFLT/FFID");
+        entity.setFfid(ffid);
+
+        String fltk = getStrVal("/MSG/DFLT/FLTK");
+        entity.setFltk(fltk);
+
+        String cfno = getStrVal("/MSG/DFLT/CFNO");
+        entity.setCfno(cfno);
+
+        String[] parts = ffid.split( "-" ); // 分割字符串
+        entity.setAwcd(parts[0]);
+        entity.setFlno(parts[1]);
+
+
+        updateAdminDfdl(entity);
+
+        // 查询机位表中是否有此航班 有就更新
+        QueryWrapper<AdminAircraftPosition> aircraftPositionQueryWrapper = new QueryWrapper<>();
+        aircraftPositionQueryWrapper.eq("flight_sole",flid);
+        AdminAircraftPosition one = getAdminAircraftPositionService().getOne(aircraftPositionQueryWrapper);
+        if (one != null) {
+            AdminDfdlList byId = getAdminDfdlListService().getById(entity.getFlid());
+            adminDfdlCopyToAirPosition(byId,one);
+        }
+    }
+}

+ 89 - 0
airport/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/imf/msg/DepeImfMsg.java

@@ -0,0 +1,89 @@
+package org.jeecg.modules.api.imf.msg;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import org.jeecg.common.util.SpringContextUtils;
+import org.jeecg.modules.admin_aircraft_position.entity.AdminAircraftPosition;
+import org.jeecg.modules.admin_dfdl_list.entity.AdminDfdlList;
+import org.jeecg.modules.admin_dfdl_mq.service.AdminDfdlMqService;
+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.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.Date;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * @author 王葆权
+ * @Title: 航班本站起飞消息
+ * @Package org.jeecg.modules.api.imf.msg
+ * @Description:
+ * @date 2023/7/20 9:44
+ */
+public class DepeImfMsg extends ImfMsgAbstract {
+
+    private IAdminSecurityCheckService adminSecurityCheckService;
+    private IAdminOrderService adminOrderService;
+
+    public DepeImfMsg(String xmlStr) {
+        super(xmlStr, ImfMsgType.DEPE);
+        adminSecurityCheckService = SpringContextUtils.getBean(IAdminSecurityCheckService.class);
+        adminOrderService = SpringContextUtils.getBean(IAdminOrderService.class);
+    }
+
+    @Override
+    @Transactional
+    public void handle() {
+        // 根据起飞时间将机位置为空置,注意起飞时AFID是原FLID
+        String FLID = getStrVal("/MSG/DFLT/FLID");
+        //起飞时间 20230619112000
+        String FRTT = getStrVal("/MSG/DFLT/FRTT");
+        Date date = strToDate(FRTT);
+        if (date != null && date.before(new Date())) {
+            // 已经起飞
+            LambdaQueryWrapper<AdminAircraftPosition> adminAircraftPositionLambdaQueryWrapper = new LambdaQueryWrapper<>();
+            adminAircraftPositionLambdaQueryWrapper.eq(AdminAircraftPosition::getFlightAfid, FLID);
+            AdminAircraftPosition adminAircraftPosition = getAdminAircraftPositionService().getOne(adminAircraftPositionLambdaQueryWrapper);
+            if (adminAircraftPosition != null) {
+                // 设置为空置
+                getAdminAircraftPositionService().dept(adminAircraftPosition.getId());
+                // 设置计划已经起飞
+                AdminDfdlList adminDfdlList = new AdminDfdlList();
+                adminDfdlList.setFfid(FLID);
+                adminDfdlList.setArrival(1);
+                updateAdminDfdl(adminDfdlList);
+
+                //还有改订单状态 删除安检信息
+                LambdaQueryWrapper<AdminOrder> adminOrderLambdaQueryWrapper = new LambdaQueryWrapper<>();
+
+                adminOrderLambdaQueryWrapper.eq(AdminOrder::getFlightAfid, FLID);
+                adminOrderLambdaQueryWrapper.ne(AdminOrder::getType, "交接结束");
+                List<AdminOrder> list1 = adminOrderService.list(adminOrderLambdaQueryWrapper);
+                if (list1.size() != 0) {
+                    for (int i = 0; i < list1.size(); i++) {
+                        AdminOrder adminOrder = new AdminOrder();
+                        adminOrder.setId(list1.get(i).getId());
+                        adminOrder.setType("交接结束");
+                        adminOrder.setQifeiTime(date);
+                        adminOrderService.updateById(adminOrder);
+                    }
+                }
+                //删安检
+                LambdaQueryWrapper<AdminSecurityCheck> adminSecurityCheckLambdaQueryWrapper = new LambdaQueryWrapper<>();
+                adminSecurityCheckLambdaQueryWrapper.eq(AdminSecurityCheck::getFlightAfid, FLID);
+                List<AdminSecurityCheck> list = adminSecurityCheckService.list(adminSecurityCheckLambdaQueryWrapper);
+                if (list.size() != 0) {
+                    List<String> ids = list.stream()
+                            .map(AdminSecurityCheck::getId)
+                            .collect(Collectors.toList());
+                    adminSecurityCheckService.removeByIds(ids);
+                }
+            }
+
+        }
+    }
+}

+ 42 - 0
airport/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/imf/msg/DfdeImfMsg.java

@@ -0,0 +1,42 @@
+package org.jeecg.modules.api.imf.msg;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.google.common.base.Strings;
+import org.jeecg.modules.admin_aircraft_position.entity.AdminAircraftPosition;
+import org.jeecg.modules.admin_dfdl_list.entity.AdminDfdlList;
+
+/**
+ * @author 王葆权
+ * @Title: 动态航班删除
+ * @Package org.jeecg.modules.api.imf.msg
+ * @Description:
+ * @date 2023/7/20 9:14
+ */
+public class DfdeImfMsg extends ImfMsgAbstract {
+
+    public DfdeImfMsg(String xmlStr) {
+        super(xmlStr, ImfMsgType.DFDE);
+    }
+
+    @Override
+    public void handle() {
+        String FLID = getStrVal("/MSG/DFLT/FLID");
+        //String FFID = getStrVal("/MSG/DFLT/FFID");
+        if (Strings.isNullOrEmpty(FLID)) {
+            // 信息缺失
+            return;
+        }
+        getAdminDfdlListService().removeById(FLID);
+        // 删除缓存
+        if (getRedisUtil().hasKey(ImfMsgType.DFDL.getRedisKey() + FLID)) {
+            getRedisUtil().del(ImfMsgType.DFDL.getRedisKey() + FLID);
+        }
+        // 删除机位
+        LambdaQueryWrapper<AdminAircraftPosition> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(AdminAircraftPosition::getFlightSole, FLID);
+        AdminAircraftPosition one = getAdminAircraftPositionService().getOne(queryWrapper);
+        if (one != null) {
+            getAdminAircraftPositionService().dept(one.getId());
+        }
+    }
+}

+ 116 - 0
airport/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/imf/msg/DfdlImfMsg.java

@@ -0,0 +1,116 @@
+package org.jeecg.modules.api.imf.msg;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.aspect.annotation.AutoLog;
+import org.jeecg.modules.admin_aircraft_position.entity.AdminAircraftPosition;
+import org.jeecg.modules.admin_dfdl_list.entity.AdminDfdlList;
+import org.jeecg.modules.admin_dfdl_mq.entity.AdminDfdlMq;
+import org.jeecg.modules.utils.ConversionUtil;
+import org.springframework.transaction.annotation.Transactional;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathExpression;
+import javax.xml.xpath.XPathExpressionException;
+import java.util.*;
+
+/**
+ * @author 王葆权
+ * @Title: DFDL动态航班整表同步事件
+ * @Package org.jeecg.modules.api.imf.msg
+ * @Description:
+ * @date 2023/7/19 11:38
+ */
+@Slf4j
+public class DfdlImfMsg extends ImfMsgAbstract {
+
+    public DfdlImfMsg(String xmlStr) {
+        super(xmlStr, ImfMsgType.DFDL);
+    }
+
+
+    /**
+     * 处理消息
+     */
+    @Override
+    @AutoLog(value = "处理DFDL计划消息")
+    @Transactional
+    public void handle() {
+        XPath xpath = getXpath();
+        XPathExpression expr = null;
+        // 计划表数据
+        List<AdminDfdlList> dfdlList = Collections.synchronizedList(new ArrayList<>());
+        // 消息表数据
+        updateDfdlMq();
+        try {
+            expr = xpath.compile("//DFLT");
+            Document document = getXmlDocument();
+            //取出所有的计划
+            NodeList nodes = (NodeList) expr.evaluate(document, XPathConstants.NODESET);
+            ObjectMapper objectMapper = getObjectMapper();
+            for (int i = 0; i < nodes.getLength(); i++) {
+                Node item = nodes.item(i);
+                //获取节点的字符串,xml格式
+                String nodeStr = ConversionUtil.NodeToString(item);
+                //xml字符串转json
+                String json = ConversionUtil.xmlToJson(nodeStr);
+                //json转对象
+                AdminDfdlList adminDfdlList = objectMapper.readValue(json, AdminDfdlList.class);
+                //处理日期
+                setStlsDate(objectMapper, nodeStr, adminDfdlList);
+                dfdlList.add(adminDfdlList);
+                //存入缓存 json格式
+                getRedisUtil().set(getMsgType().getRedisKey() + adminDfdlList.getFlid(), json);
+            }
+        } catch (XPathExpressionException e) {
+            throw new RuntimeException(e);
+        } catch (JsonMappingException e) {
+            throw new RuntimeException(e);
+        } catch (JsonProcessingException e) {
+            throw new RuntimeException(e);
+        }
+
+        //批量插入表中
+        if (!dfdlList.isEmpty()) {
+            boolean b = getAdminDfdlListService().saveOrUpdateBatch(dfdlList);
+            log.info("添加计划{}", b ? "成功" : "失败");
+            //处理机位信息
+            updateAircraftPosition(dfdlList);
+        }
+
+    }
+
+    /**
+     * 更新机位表数据
+     * 同步前一天落地但没有起飞的  也就是没有AFID的
+     * @param dfdlList 新的计划列表
+     */
+    private void updateAircraftPosition(List<AdminDfdlList> dfdlList) {
+        LambdaQueryWrapper<AdminAircraftPosition> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.isNotNull(AdminAircraftPosition::getFlightSole);
+        queryWrapper.eq(AdminAircraftPosition::getFlightAfid, "");
+        List<AdminAircraftPosition> adminAircraftPositionList = getAdminAircraftPositionService().list(queryWrapper);
+        // 机位表数据
+        for (AdminAircraftPosition adminAircraftPosition : adminAircraftPositionList) {
+            for (AdminDfdlList adminDfdlList : dfdlList) {
+                adminDfdlCopyToAirPosition(adminDfdlList, adminAircraftPosition);
+            }
+        }
+        getAdminAircraftPositionService().updateBatchById(adminAircraftPositionList);
+    }
+
+    private void updateDfdlMq() {
+        AdminDfdlMq adminDfdlMq = new AdminDfdlMq();
+        adminDfdlMq.setId("1");
+        adminDfdlMq.setDfdl(getXmlStr());
+        adminDfdlMq.setUpdateTime(new Date());
+        getAdminDfdlMqService().updateById(adminDfdlMq);
+    }
+}

+ 40 - 0
airport/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/imf/msg/DfieImfMsg.java

@@ -0,0 +1,40 @@
+package org.jeecg.modules.api.imf.msg;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.jeecg.modules.admin_dfdl_list.entity.AdminDfdlList;
+import org.jeecg.modules.utils.ConversionUtil;
+
+/**
+ * @author 王葆权
+ * @Title: 航班动态增加信息
+ * @Package org.jeecg.modules.api.imf.msg
+ * @Description:
+ * @date 2023/7/20 9:04
+ */
+public class DfieImfMsg extends ImfMsgAbstract {
+
+    public DfieImfMsg(String xmlStr) {
+        super(xmlStr, ImfMsgType.DFIE);
+    }
+
+    @Override
+    public void handle() {
+        // 添加航班计划信息
+        String content = getContent();
+        String json = ConversionUtil.xmlToJson(content);
+        ObjectMapper objectMapper = getObjectMapper();
+        AdminDfdlList adminDfdlList = null;
+        try {
+            adminDfdlList = objectMapper.readValue(json, AdminDfdlList.class);
+        } catch (JsonProcessingException e) {
+            throw new RuntimeException(e);
+        }
+        boolean save = getAdminDfdlListService().save(adminDfdlList);
+        // 添加缓存
+        if (save) {
+            // 计划缓存
+            getRedisUtil().set(ImfMsgType.DFDL.getRedisKey() + adminDfdlList.getFlid(), json);
+        }
+    }
+}

+ 62 - 0
airport/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/imf/msg/HbttImfMsg.java

@@ -0,0 +1,62 @@
+package org.jeecg.modules.api.imf.msg;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import org.jeecg.modules.admin_aircraft_position.entity.AdminAircraftPosition;
+import org.jeecg.modules.admin_dfdl_list.entity.AdminDfdlList;
+
+/**
+ * @author 王葆权
+ * @Title: 航班号变更消息
+ * @Package org.jeecg.modules.api.imf.msg
+ * @Description:
+ * @date 2023/7/20 9:23
+ */
+public class HbttImfMsg extends ImfMsgAbstract {
+    public HbttImfMsg(String xmlStr) {
+        super(xmlStr, ImfMsgType.HBTT);
+    }
+
+    @Override
+    public void handle() {
+        String FLID = getStrVal("/MSG/DFLT/FLID");
+        String FFID = getStrVal("/MSG/DFLT/FFID");
+        String HBID = getStrVal("/MSG/DFLT/HBID");
+        String NFLN = getStrVal("/MSG/DFLT/NFLN");
+        String NAWC = getStrVal("/MSG/DFLT/NAWC");
+        AdminDfdlList oldPlan = getAdminDfdlListService().getById(FLID);
+        if (oldPlan != null) {
+            UpdateWrapper<AdminDfdlList> adminDfdlListUpdateWrapper = new UpdateWrapper<>();
+            adminDfdlListUpdateWrapper.eq("flid", FLID).eq("ffid", FFID).set("ffid", HBID).set("flno", NFLN).set("awcd", NAWC);
+            boolean update = getAdminDfdlListService().update(adminDfdlListUpdateWrapper);
+            if (update) {
+                // 数据库更新成功,更新缓存
+                AdminDfdlList byId = getAdminDfdlListService().getById(FFID);
+                String adminDfdlJson = null;
+                try {
+                    adminDfdlJson = getObjectMapper().writeValueAsString(byId);
+                } catch (JsonProcessingException e) {
+                    throw new RuntimeException(e);
+                }
+                getRedisUtil().set(ImfMsgType.DFDL.getRedisKey() + FLID, adminDfdlJson);
+
+                // 更新机位表
+                LambdaQueryWrapper<AdminAircraftPosition> adminAircraftPositionLambdaQueryWrapperWrapper = new LambdaQueryWrapper<>();
+                adminAircraftPositionLambdaQueryWrapperWrapper
+                        .eq(AdminAircraftPosition::getFlightSole, oldPlan.getFlid())
+                        .eq(AdminAircraftPosition::getFlightAfid, oldPlan.getAfid())
+                        .eq(AdminAircraftPosition::getFlightNum, oldPlan.getAwcd() + "-" + oldPlan.getFlno())
+                        .eq(AdminAircraftPosition::getAircraftNum,oldPlan.getCfno())
+                ;
+                AdminAircraftPosition one = getAdminAircraftPositionService().getOne(adminAircraftPositionLambdaQueryWrapperWrapper);
+                if (one != null) {
+                    one.setFlightNum(byId.getAwcd()+"-"+byId.getFlno());
+                    getAdminAircraftPositionService().updateById(one);
+                }
+            }
+        }
+
+    }
+}

+ 29 - 0
airport/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/imf/msg/ImfMsg.java

@@ -0,0 +1,29 @@
+package org.jeecg.modules.api.imf.msg;
+
+import org.w3c.dom.Document;
+
+import javax.xml.xpath.XPath;
+
+/**
+ * @author 王葆权
+ * @Title: imf消息实体接口
+ * @Package org.jeecg.modules.api.imf.msg
+ * @Description:
+ * @date 2023/7/17 11:58
+ */
+public interface ImfMsg extends ImfMsgOperation {
+
+    //获取消息头
+    String getHeader();
+
+    ImfMsgHeader getHeaderObject();
+
+    //获取消息体
+    String getContent();
+
+    /**
+     * 获取消息类型名称
+     * @return
+     */
+    String getTypeName();
+}

+ 391 - 0
airport/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/imf/msg/ImfMsgAbstract.java

@@ -0,0 +1,391 @@
+package org.jeecg.modules.api.imf.msg;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.MapperFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.json.JsonMapper;
+import com.google.common.base.Strings;
+import lombok.SneakyThrows;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.boot.starter.rabbitmq.client.RabbitMqClient;
+import org.jeecg.common.util.RedisUtil;
+import org.jeecg.common.util.SpringContextUtils;
+import org.jeecg.modules.admin_aircraft_position.entity.AdminAircraftPosition;
+import org.jeecg.modules.admin_aircraft_position.service.IAdminAircraftPositionService;
+import org.jeecg.modules.admin_dfdl_list.entity.AdminDfdlList;
+import org.jeecg.modules.admin_dfdl_list.service.IAdminDfdlListService;
+import org.jeecg.modules.admin_dfdl_mq.service.AdminDfdlMqService;
+import org.jeecg.modules.utils.ConversionUtil;
+import org.springframework.context.ApplicationContext;
+import org.w3c.dom.Document;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathFactory;
+import java.io.IOException;
+import java.io.StringReader;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * @author 王葆权
+ * @Title:
+ * @Package org.jeecg.modules.api.imf.msg
+ * @Description:
+ * @date 2023/7/18 10:07
+ */
+@Slf4j
+abstract class ImfMsgAbstract<T extends ImfMsgType> implements ImfMsg {
+
+    /**
+     * 存储mq中发送的dfdl原消息
+     */
+    private AdminDfdlMqService adminDfdlMqService;
+
+    /**
+     * 机位表
+     */
+    private IAdminAircraftPositionService adminAircraftPositionService;
+
+    /**
+     * redis工具
+     */
+    private RedisUtil redisUtil;
+
+    /**
+     * rabbitMq客户端
+     */
+    private RabbitMqClient rabbitMqClient;
+
+    /**
+     * 计划表
+     */
+    private IAdminDfdlListService adminDfdlListService;
+
+    /**
+     * 是否转发处理消息事件
+     */
+    private boolean msgHandlerEvent;
+
+    // 消息头的正则
+    public static final String HEAD_REG = "<META>(.*?)</META>";
+    // 消息体的正则
+    public static final String CONTENT_REG = "<DFLT>(.*?)</DFLT>";
+    // 到达时间的正则
+    public static final String STND_REGEX = "<STND>(.*?)</STND>";
+
+    //xml字符串
+    private String xmlStr;
+
+    //文档字符串
+    private Document xmlDocument;
+
+    // 消息类型枚举
+    private T msgType;
+
+    public ImfMsgAbstract(String xmlStr, T msgType) {
+        setXmlStr(xmlStr);
+        setXmlDocument(xmlStrToDoc(xmlStr));
+        setMsgType(msgType);
+        adminDfdlMqService = SpringContextUtils.getBean(AdminDfdlMqService.class);
+        adminAircraftPositionService = SpringContextUtils.getBean(IAdminAircraftPositionService.class);
+        redisUtil = SpringContextUtils.getBean(RedisUtil.class);
+        rabbitMqClient = SpringContextUtils.getBean(RabbitMqClient.class);
+        adminDfdlListService = SpringContextUtils.getBean(IAdminDfdlListService.class);
+        ApplicationContext applicationContext = SpringContextUtils.getApplicationContext();
+        msgHandlerEvent = applicationContext.getEnvironment().getProperty("airport.mq.msgHandlerEvent", boolean.class);
+    }
+
+    @Override
+    public void process() {
+        log.info("【{}】开始处理", getTypeDescription());
+        handle();
+        log.info("【{}】结束处理", getTypeDescription());
+    }
+
+    @Override
+    public synchronized Document xmlStrToDoc(String xml) {
+        Document doc = null;
+        try {
+            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+            doc = factory.newDocumentBuilder().parse(new InputSource(new StringReader(xml)));
+        } catch (SAXException e) {
+            throw new RuntimeException(e);
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        } catch (ParserConfigurationException e) {
+            throw new RuntimeException(e);
+        }
+        return doc;
+    }
+
+    @Override
+    public synchronized XPath getXpath() {
+        XPathFactory xPathfactory = XPathFactory.newInstance();
+        XPath xpath = xPathfactory.newXPath();
+        return xpath;
+    }
+
+    @SneakyThrows
+    @Override
+    public String getStrVal(String expression) {
+        XPath xpath = getXpath();
+        Object evaluate = xpath.evaluate(expression, getXmlDocument(), XPathConstants.STRING);
+        return String.valueOf(evaluate);
+    }
+
+    @Override
+    public String xmlToJson(String xml) {
+        return ConversionUtil.xmlToJson(xml);
+    }
+
+    /**
+     * 获取类型名称
+     *
+     * @return
+     */
+    @Override
+    public String getTypeName() {
+        return getMsgType().getName();
+    }
+
+    /**
+     * 获取消息头
+     *
+     * @return json
+     */
+    @Override
+    public String getHeader() {
+        return ConversionUtil.xmlToJson(regStr(HEAD_REG, getXmlStr()));
+    }
+
+    @Override
+    public ImfMsgHeader getHeaderObject() {
+        JsonMapper jsonMapper = new JsonMapper();
+        ImfMsgHeader imfMsgHeader = null;
+        try {
+            imfMsgHeader = jsonMapper.readValue(getHeader(), ImfMsgHeader.class);
+        } catch (JsonProcessingException e) {
+            throw new RuntimeException(e);
+        }
+        return imfMsgHeader;
+    }
+
+    /**
+     * 获取消息体
+     * 这里不做转换 需要自定义处理
+     *
+     * @return xml
+     */
+    @Override
+    public String getContent() {
+        return regStr(CONTENT_REG, getXmlStr());
+    }
+
+    /**
+     * 使用正则表达式获取字符串
+     *
+     * @param regStr 表达式
+     * @param str    要查找的字符串
+     * @return 找到的字符串,找不到返回null
+     */
+    public String regStr(String regStr, String str) {
+        Pattern pattern = Pattern.compile(regStr);
+        Matcher matcher = pattern.matcher(str);
+        if (matcher.find()) {
+            return matcher.group();
+        }
+        return null;
+    }
+
+    /**
+     * 获取类型描述
+     *
+     * @return
+     */
+    public String getTypeDescription() {
+        return getMsgType().getDescription();
+    }
+
+    public String getXmlStr() {
+        return xmlStr;
+    }
+
+    public void setXmlStr(String xmlStr) {
+        this.xmlStr = xmlStr;
+    }
+
+    public Document getXmlDocument() {
+        return xmlDocument;
+    }
+
+    public void setXmlDocument(Document xmlDocument) {
+        this.xmlDocument = xmlDocument;
+    }
+
+    public T getMsgType() {
+        return msgType;
+    }
+
+    public void setMsgType(T msgType) {
+        this.msgType = msgType;
+    }
+
+    public AdminDfdlMqService getAdminDfdlMqService() {
+        return adminDfdlMqService;
+    }
+
+    public IAdminAircraftPositionService getAdminAircraftPositionService() {
+        return adminAircraftPositionService;
+    }
+
+    public IAdminDfdlListService getAdminDfdlListService() {
+        return adminDfdlListService;
+    }
+
+    public RedisUtil getRedisUtil() {
+        return redisUtil;
+    }
+
+    public RabbitMqClient getRabbitMqClient() {
+        return rabbitMqClient;
+    }
+
+    public boolean isMsgHandlerEvent() {
+        return msgHandlerEvent;
+    }
+
+    public ObjectMapper getObjectMapper() {
+        ObjectMapper objectMapper = new ObjectMapper();
+        //忽略大小写
+        objectMapper.configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES, true);
+        //忽略多余内容
+        objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+        return objectMapper;
+    }
+
+    /**
+     * 将字符串转换为时间
+     * 目前消息中时间格式都是 yyyyMMddHHmmss
+     *
+     * @param str
+     * @return
+     */
+    public Date strToDate(String str) {
+
+        if (!Strings.isNullOrEmpty(str)) {
+            SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
+            //预计开始占用时间
+            try {
+                return sdf.parse(str);
+            } catch (ParseException e) {
+                log.error("日期转换出错");
+                throw new RuntimeException(e);
+            }
+        }
+        return null;
+    }
+
+    /**
+     * 将计划中的信息复制给机位中的消息
+     *
+     * @param adminDfdlList 计划
+     * @param airPosition   机位
+     */
+    void adminDfdlCopyToAirPosition(AdminDfdlList adminDfdlList, AdminAircraftPosition airPosition) {
+        airPosition.setFlightSole(String.valueOf(adminDfdlList.getFlid()));
+        airPosition.setFlightAfid(String.valueOf(adminDfdlList.getAfid()));
+        airPosition.setFlightNum(adminDfdlList.getAwcd() + "-" + adminDfdlList.getFlno());
+        airPosition.setAircraftNum(adminDfdlList.getCfno());
+        airPosition.setEstr(adminDfdlList.getEstr());
+        airPosition.setEend(adminDfdlList.getEend());
+        airPosition.setRstr(adminDfdlList.getRstr());
+        airPosition.setRend(adminDfdlList.getRend());
+    }
+
+    void setStlsDate(ObjectMapper objectMapper, String nodeStr, AdminDfdlList adminDfdlList) {
+        String gateStr = regStr(STND_REGEX, nodeStr);
+        if (Strings.isNullOrEmpty(gateStr)) {
+            return;
+        }
+        String gateJson = ConversionUtil.xmlToJson(gateStr);
+        Map map = null;
+        try {
+            map = objectMapper.readValue(gateJson, Map.class);
+        } catch (JsonProcessingException e) {
+            throw new RuntimeException(e);
+        }
+        Object estr = map.get("ESTR");
+        if (estr != null) {
+            adminDfdlList.setEstr(strToDate(String.valueOf(estr)));
+        }
+        Object eend = map.get("EEND");
+        if (eend != null) {
+            adminDfdlList.setEend(strToDate(String.valueOf(eend)));
+        }
+
+        Object rstr = map.get("RSTR");
+        if (rstr != null) {
+            adminDfdlList.setRstr(strToDate(String.valueOf(rstr)));
+        }
+        Object rend = map.get("REND");
+        if (rend != null) {
+            adminDfdlList.setRend(strToDate(String.valueOf(rend)));
+        }
+    }
+
+    void setStlsDate(AdminDfdlList adminDfdlList){
+        setStlsDate(getObjectMapper(),getXmlStr(),adminDfdlList);
+    }
+
+    Map getStlsDateMap(ObjectMapper objectMapper, String nodeStr) {
+        String gateStr = regStr(STND_REGEX, nodeStr);
+        String gateJson = ConversionUtil.xmlToJson(gateStr);
+        Map map = null;
+        try {
+            map = objectMapper.readValue(gateJson, Map.class);
+        } catch (JsonProcessingException e) {
+            throw new RuntimeException(e);
+        }
+        return map;
+    }
+
+    Map getStlsDateMap(String nodeStr) {
+        return getStlsDateMap(getObjectMapper(), nodeStr);
+    }
+
+    /**
+     * 更新计划
+     *
+     * @return
+     */
+    boolean updateAdminDfdl(AdminDfdlList adminDfdlList) {
+        if (adminDfdlList == null || adminDfdlList.getFlid() == null) {
+            return false;
+        }
+        log.info("更新计划flid:{}",adminDfdlList.getFlid());
+        boolean b = getAdminDfdlListService().updateById(adminDfdlList);
+        if (b) {
+            //更新缓存
+            String key = ImfMsgType.DFDL.getRedisKey() + adminDfdlList.getFlid();
+            if (getRedisUtil().hasKey(key)) {
+                try {
+                    AdminDfdlList byId = getAdminDfdlListService().getById(adminDfdlList.getFlid());
+                    getRedisUtil().set(key, getObjectMapper().writeValueAsString(byId));
+                } catch (JsonProcessingException e) {
+                    throw new RuntimeException(e);
+                }
+            }
+        }
+        return b;
+    }
+}

+ 28 - 0
airport/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/imf/msg/ImfMsgHeader.java

@@ -0,0 +1,28 @@
+package org.jeecg.modules.api.imf.msg;
+
+import lombok.Data;
+
+/**
+ * @author 王葆权
+ * @Title:
+ * @Package org.jeecg.modules.api.imf.msg
+ * @Description:
+ * @date 2023/7/19 14:35
+ */
+@Data
+public class ImfMsgHeader {
+
+    //消息发送者
+    private String SNDR;
+    //消息接收着
+    private String RCVR;
+    //消息序号
+    private String SEQN;
+    //发送时间
+    private String DDTM;
+    //消息类别
+    private String TYPE;
+    //消息类型
+    private String STYP;
+
+}

+ 54 - 0
airport/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/imf/msg/ImfMsgOperation.java

@@ -0,0 +1,54 @@
+package org.jeecg.modules.api.imf.msg;
+
+import org.w3c.dom.Document;
+
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+
+/**
+ * @author 王葆权
+ * @Title: 对消息的操作
+ * @Package org.jeecg.modules.api.imf.msg
+ * @Description:
+ * @date 2023/7/19 11:18
+ */
+public interface ImfMsgOperation {
+    /**
+     * 获取String类型的值
+     *
+     * @param expression xpath表达式
+     * @return 对应的值,没有返回null
+     */
+    String getStrVal(String expression);
+
+
+    /**
+     * 获取Xpath
+     *
+     * @return xPath对象
+     */
+    XPath getXpath();
+
+
+    /**
+     * 将xml字符串转换为文档类型
+     *
+     * @param xml
+     * @return 文档类型
+     */
+    Document xmlStrToDoc(String xml);
+
+
+    //处理xml为Json
+    String xmlToJson(String xml);
+
+    /**
+     * 消息的一些流程上的处理
+     */
+    void process();
+
+    /**
+     * 消息处理逻辑
+     */
+    void handle();
+}

+ 37 - 0
airport/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/imf/msg/ImfMsgType.java

@@ -0,0 +1,37 @@
+package org.jeecg.modules.api.imf.msg;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+/**
+ * @author 王葆权
+ * @Title: Imf消息类型
+ * @Package org.jeecg.modules.api.imf.msg
+ * @Description:
+ * @date 2023/7/19 11:40
+ */
+@Getter
+@AllArgsConstructor
+public enum ImfMsgType {
+    DFDL("DFDL", "动态航班整表同步事件","DFDL_"),
+    STLS("STLS", "航班机位动态信息更新事件","STLS_"),
+    DEPE("DEPE", "航班本站起飞消息","DEPE_"),
+    ARRE("ARRE", "航班到达本站消息","ARRE_"),
+    CFCE("CFCE", "航班更换飞机消息","CFCE_"),
+    DFIE("DFIE", "航班动态增加信息","DFIE_"),
+    DFDE("DFDE", "动态航班删除","DFDE_"),
+    HBTT("HBTT", "航班号变更消息","HBTT_");
+    private final String name;
+    private final String description;
+    private final String redisKey;
+
+    public static ImfMsgType findByName(String name){
+        ImfMsgType[] values = values();
+        for (ImfMsgType value : values) {
+            if (value.name.equals(name)){
+                return value;
+            }
+        }
+        return null;
+    }
+}

+ 61 - 0
airport/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/imf/msg/ImfMsgUtil.java

@@ -0,0 +1,61 @@
+package org.jeecg.modules.api.imf.msg;
+
+import lombok.extern.slf4j.Slf4j;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * @author 王葆权
+ * @Title: imf消息工具类
+ * @Package org.jeecg.modules.api.imf.msg
+ * @Description:
+ * @date 2023/7/19 19:09
+ */
+@Slf4j
+public class ImfMsgUtil {
+
+    public static ImfMsg getImfMsgObject(String xmlString) {
+        Pattern compile = Pattern.compile("<STYP>(.*?)</STYP>");
+        Matcher matcher = compile.matcher(xmlString);
+        boolean b = matcher.find();
+        if (b) {
+            String group = matcher.group();
+            String styp = group.replace("<STYP>", "").replace("</STYP>", "");
+            return getImfMsgAbstractByType(xmlString, styp);
+        } else {
+            log.error("未找到消息类型");
+            return null;
+        }
+    }
+
+    @Nullable
+    private static ImfMsgAbstract getImfMsgAbstractByType(String xmlString, String styp) {
+        ImfMsgType byName = ImfMsgType.findByName(styp);
+        if (byName != null) {
+            if (byName.getName().equals(ImfMsgType.DFDL.getName())) {
+                // 计划消息
+                return new DfdlImfMsg(xmlString);
+            } else if (byName.getName().equals(ImfMsgType.STLS.getName())) {
+                return new StlsImfMsg(xmlString);
+            } else if (byName.getName().equals(ImfMsgType.DEPE.getName())) {
+                return new DepeImfMsg(xmlString);
+            } else if (byName.getName().equals(ImfMsgType.ARRE.getName())) {
+                return new ArreImfMsg(xmlString);
+            } else if (byName.getName().equals(ImfMsgType.CFCE.getName())) {
+                return new CfceImfMsg(xmlString);
+            } else if (byName.getName().equals(ImfMsgType.DFIE.getName())) {
+                return new DfieImfMsg(xmlString);
+            } else if (byName.getName().equals(ImfMsgType.DFDE.getName())) {
+                return new DfdeImfMsg(xmlString);
+            } else if (byName.getName().equals(ImfMsgType.HBTT.getName())) {
+                return new HbttImfMsg(xmlString);
+
+            }
+        }
+        log.error("未知的消息类型{}", byName);
+        return null;
+    }
+
+}

+ 293 - 0
airport/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/imf/msg/StlsImfMsg.java

@@ -0,0 +1,293 @@
+package org.jeecg.modules.api.imf.msg;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.common.base.Strings;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.modules.admin_aircraft_position.entity.AdminAircraftPosition;
+import org.jeecg.modules.admin_dfdl_list.entity.AdminDfdlList;
+
+import java.util.Date;
+import java.util.Map;
+
+/**
+ * @author 王葆权
+ * @Title: 航班机位动态信息更新事件
+ * @Package org.jeecg.modules.api.imf.msg
+ * @Description:
+ * @date 2023/7/20 10:44
+ */
+@Slf4j
+public class StlsImfMsg extends ImfMsgAbstract {
+
+    public StlsImfMsg(String xmlStr) {
+        super(xmlStr, ImfMsgType.STLS);
+    }
+
+    /**
+     * 根据动态数据更新机位表中入站和出站的飞机
+     * 需要特殊处理情况:
+     * 1.有实际占用时间且当前时间在预计占用时间范围内直接更新
+     * 2.同一航班不同机位号(机位更换)
+     * 3.同机位不同航班不同占用时间
+     */
+    @Override
+    public void handle() {
+        // 根据动态更新航班对应的机位
+        String FLID = getStrVal("/MSG/DFLT/FLID");
+        AdminDfdlList dfdlList = getAdminDfdl(FLID);
+        if (dfdlList == null) {
+            // 没有的计划
+            return;
+        }
+        // 先更新计划时间
+        updateAdminDfdlTime(dfdlList);
+        if ("A".equals(dfdlList.getFlio())) {
+            log.info("进站飞机");
+            // 机位
+            String CODE = getStrVal("/MSG/DFLT/STLS/STND/CODE");
+            if (Strings.isNullOrEmpty(CODE)) {
+                log.error("未获取到机位!(/MSG/DFLT/STLS/STND/CODE)");
+                return;
+            }
+            Date now = new Date();
+            LambdaQueryWrapper<AdminAircraftPosition> adminAircraftPositionLambdaQueryWrapper = new LambdaQueryWrapper<>();
+            adminAircraftPositionLambdaQueryWrapper.eq(AdminAircraftPosition::getAircraftPositionNum, CODE);
+            AdminAircraftPosition aircraftPosition = getAdminAircraftPositionService().getOne(adminAircraftPositionLambdaQueryWrapper);
+            if (aircraftPosition != null) {
+                log.info("查询到相应的机位:{}", CODE);
+                log.info("机位当前信息:{}", aircraftPosition);
+                // 有这个机位
+                AdminDfdlList adminDfdlList = getAdminDfdlListService().getById(FLID);
+                if (adminDfdlList == null) {
+                    // 没有计划
+                    log.error("此航班【{}】,没有计划", FLID);
+                    return;
+                }
+                log.info("查询到计划内容:{}", adminDfdlList);
+                if (adminDfdlList.getArrival() > 0) {
+                    //已经到站
+                    log.info("此航班【{}】,已经到站,判断是否出站", FLID);
+                    //判断是否出站
+                    if (adminDfdlList.getRend() != null && adminDfdlList.getRend().before(now)) {
+                        // 已经出站
+                        getAdminAircraftPositionService().dept(FLID);
+                        //return;
+                    } else {
+                        // 没出站
+                    }
+                    return;
+                }
+                //判断是否出站 防止arrival为0但是已经出战
+                if (adminDfdlList.getRend() != null && adminDfdlList.getRend().before(now)) {
+                    // 已经出站
+                    getAdminAircraftPositionService().dept(FLID);
+                    adminDfdlList.setArrival(1);
+                    updateAdminDfdl(adminDfdlList);
+                    log.info("此航班【{}】,已经出站", FLID);
+                    return;
+                }
+                //标识是否交换过数据
+                boolean isChangeFlag = false;
+                //判断是否更换了机位
+                LambdaQueryWrapper<AdminAircraftPosition> aircraftPositionByFlidQueryWrapper = new LambdaQueryWrapper<>();
+                aircraftPositionByFlidQueryWrapper.eq(AdminAircraftPosition::getFlightSole, FLID);
+                AdminAircraftPosition adminAircraftPosition = getAdminAircraftPositionService().getOne(aircraftPositionByFlidQueryWrapper);
+                if (adminAircraftPosition != null) {
+                    log.info("此航班【{}】在机位表中被发现", FLID);
+                    //FLID匹配到的机位号 和 进来的机位号  不是  一个   换机位  清空原机位信息
+                    if (!adminAircraftPosition.getAircraftPositionNum().equals(CODE)) {
+                        log.info("此航班【{}】与对应机位所属数据不匹配,进行交换机位数据操作", FLID);
+                        //表中有但不是一个机位
+                        //给新匹配到的机位上附上信息
+                        aircraftPosition.setAircraftNum(adminAircraftPosition.getAircraftNum());
+                        aircraftPosition.setType(adminAircraftPosition.getType());
+                        aircraftPosition.setDropTime(adminAircraftPosition.getDropTime());
+                        aircraftPosition.setFlightNum(adminAircraftPosition.getFlightNum());
+                        aircraftPosition.setFlightAfid(adminAircraftPosition.getFlightAfid());
+                        //清空旧的机位
+                        getAdminAircraftPositionService().dept(adminAircraftPosition.getId());
+                        isChangeFlag = true;
+                    } else {
+                        // 是一个机位
+                    }
+                }
+
+                // 判断是否已经占用机位
+                Map map = getStlsDateMap(getXmlStr());
+                Object rstr = map.get("RSTR");
+
+                if (rstr != null) {
+                    log.info("判断flid:{}是否已经占用机位",adminDfdlList.getFlid());
+                    // 有开始占用时间,证明到站了
+                    Object rend = map.get("REND");
+                    if (rend != null) {
+                        log.info("flid:{},有实际结束占用时间{}",adminDfdlList.getFlid(),String.valueOf(rend));
+                        // 有结束占用机位的时间
+                        Date rendDate = strToDate(String.valueOf(rend));
+                        if (rendDate.before(now)) {
+                            log.info("flid:{},有实际结束占用时间{}, 且小于当前时间, 清空机位",adminDfdlList.getFlid(),String.valueOf(rend));
+                            //不在占用时间范围内,结束占用机位,清空机位后续不做处理
+                            getAdminAircraftPositionService().dept(aircraftPosition.getId());
+                            adminDfdlList.setArrival(1);
+                            updateAdminDfdl(adminDfdlList);
+                            //结束
+                            return;
+                        } else {
+                            // 在占用时间范围内,到站
+                            log.info("flid:{},有实际结束占用时间{},且大于当前时间",adminDfdlList.getFlid(),rendDate);
+                        }
+                    } else {
+                        // 没有结束占用时间,到站
+                        log.info("flid:{},没有实际结束占用时间,判断是否有实际开始占用时间",adminDfdlList.getFlid());
+                        // 判断到站时间是否在当前时间之前,避免脏数据
+                        Date rstrDate = strToDate(String.valueOf(rstr));
+                        if (rstrDate!=null) {
+                            log.info("flid:{},有实际开始占用时间{},应占用机位",rstrDate ,adminDfdlList.getFlid());
+                            // 到站
+                            aircraftPosition.setType("使用中");
+                            adminDfdlList.setArrival(1);
+                            setStlsDate(adminDfdlList);
+                            if (!isChangeFlag) {
+                                log.info("flid:{},copy",adminDfdlList.getFlid());
+                                adminDfdlCopyToAirPosition(adminDfdlList, aircraftPosition);
+                            }
+                            // 更新机位
+                            getAdminAircraftPositionService().updateById(aircraftPosition);
+                            // 更新计划
+                            updateAdminDfdl(adminDfdlList);
+                            // 结束
+                            return;
+                        }
+                    }
+                } else {
+                    // 没有实际占用时间,设置预计时间
+                    log.info("flid:{},没有实际占用时间",adminDfdlList.getFlid());
+                }
+
+                if(adminAircraftPosition == null){
+                    log.info("此航班【{}】未在机位表中被发现,判断是否有结束时间,有直接占用,没有判断机位上航班【{}】是否结束占用没结束就不占用", FLID, aircraftPosition.getFlightSole());
+                    // 在机位表中没有找到航班对应的机位, 判断机位上航班是否结束占用
+                    if (aircraftPosition.getFlightSole() != null && !FLID.equals(aircraftPosition.getFlightSole())) {
+                        // 不是一个航班,判断谁应该在这段时间占用
+                        //查询机位上航班所在计划中的信息
+                        AdminDfdlList byId = getAdminDfdlListService().getById(aircraftPosition.getFlightSole());
+                        if (byId != null) {
+                            log.info("机位【{}】上的航班flid:{}在计划中", CODE, byId.getFlid());
+                            if (byId.getArrival() > 0) {
+                                log.info("当前机位【{}】的航班到站FLID:{}", CODE, byId.getFlid());
+                                // 已经到站, 判断是否结束占用
+                                if (isArrival(CODE, now, byId)) return;
+                            } else {
+                                log.info("当前机位【{}】的航班未到站FLID:{}", CODE, byId.getFlid());
+                                // 机位上的数据未到站
+                                // 不需要占用机位就返回
+                                if (!isArrival(CODE, now, adminDfdlList)) {
+                                    log.info("不需要占用");
+                                    return;
+                                } else {
+                                    log.info("需要占用,设置到站值为1");
+                                    adminDfdlList.setArrival(1);
+                                }
+                            }
+
+                        } else {
+                            log.info("机位【{}】上的航班flid:{}不在计划中", CODE, aircraftPosition.getFlightSole());
+                            // 没有此计划
+                            log.error("判断机位冲突时发现此航班【{}】,没有计划", adminAircraftPosition.getFlightSole());
+                        }
+                    }
+                }
+
+                // 更新数据
+                // 更新机位对应的航班
+                aircraftPosition.setFlightSole(FLID);
+                getAdminAircraftPositionService().updateById(aircraftPosition);
+                // 更新计划
+                updateAdminDfdl(adminDfdlList);
+                log.info("最终更新计划数据:{}",adminDfdlList);
+                log.info("最终更新机位数据:{}",aircraftPosition);
+            } else {
+                log.error("未找到对应机位【{}】", CODE);
+            }
+        }
+    }
+
+    /**
+     * 判断已经到站的飞机是否需要占用机位
+     * 需要返回 true
+     * 不需要返回 false
+     *
+     * @param CODE 机位代码
+     * @param now  判断时间
+     * @param byId 计划
+     * @return
+     */
+    private boolean isArrival(String CODE, Date now, AdminDfdlList byId) {
+        // 实际开始占用时间
+        Date rstr = byId.getRstr();
+        // 实际结束占用时间
+        Date rend = byId.getRend();
+        if (rstr != null) {
+            // 已经占用了
+            if (rend != null && rend.before(now)) {
+                // 结束占用
+            } else {
+                // 未结束占用
+                log.info("当前机位【{}】已被占用,且未结束占用,FLID:{}需要占用", CODE, byId.getFlid());
+                return true;
+            }
+        } else {
+            // 判断预计时间
+            Date estr = byId.getEstr();
+            Date eend = byId.getEend();
+            if (estr != null && estr.before(now)) {
+                // 开始占用了
+                if (eend != null && eend.before(now)) {
+                    // 结束占用
+                } else {
+                    // 未结束占用
+                    log.info("当前机位【{}】已被占用,且未结束占用,FLID:{}需要占用", CODE, byId.getFlid());
+                    return true;
+                }
+            }
+        }
+        log.info("当前机位【{}】不需要被FLID:{}占用", CODE, byId.getFlid());
+        return false;
+    }
+
+    /**
+     * 获取计划
+     *
+     * @param FLID
+     * @return
+     */
+    private AdminDfdlList getAdminDfdl(String FLID) {
+        AdminDfdlList dfdlList;
+        ObjectMapper objectMapper = getObjectMapper();
+        if (getRedisUtil().hasKey(ImfMsgType.DFDL.getRedisKey() + FLID)) {
+            String dfdlJson = (String) getRedisUtil().get(ImfMsgType.DFDL.getRedisKey() + FLID);
+            try {
+                dfdlList = objectMapper.readValue(dfdlJson, AdminDfdlList.class);
+            } catch (JsonProcessingException e) {
+                throw new RuntimeException(e);
+            }
+        } else {
+            // 缓存没有从表里面取
+            dfdlList = getAdminDfdlListService().getById(FLID);
+            try {
+                getRedisUtil().set(ImfMsgType.DFDL.getRedisKey() + FLID, objectMapper.writeValueAsString(dfdlList));
+            } catch (JsonProcessingException e) {
+                throw new RuntimeException(e);
+            }
+        }
+        return dfdlList;
+    }
+
+
+    private void updateAdminDfdlTime(AdminDfdlList dfdlList) {
+        setStlsDate(dfdlList);
+        updateAdminDfdl(dfdlList);
+    }
+}

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

@@ -2,8 +2,15 @@ package org.jeecg.modules.utils;
 
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.dataformat.xml.XmlMapper;
+import org.w3c.dom.Node;
 
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
 import java.io.IOException;
+import java.io.StringWriter;
 
 /**
  * @author 王葆权
@@ -26,6 +33,11 @@ public class ConversionUtil {
         return XML_MAPPER;
     }
 
+    /**
+     * 将xml转化为json
+     * @param xml xml字符串
+     * @return json格式
+     */
     public static String xmlToJson(String xml) {
         try {
             return getJsonMapper().writeValueAsString(getXmlMapper().readTree(xml));
@@ -34,4 +46,33 @@ public class ConversionUtil {
             return "";
         }
     }
+
+    /**
+     * 将node中的内容转化为字符串
+     * @param node org.w3c.dom.Node
+     * @return 节点中的内容
+     */
+    public static String NodeToString(Node node) {
+        Transformer transformer = null;
+        String result = null;
+        if (node == null) {
+            throw new IllegalArgumentException();
+        }
+        try {
+            transformer = TransformerFactory.newInstance().newTransformer();
+        } catch (Exception e) {
+            throw new RuntimeException(e.getMessage());
+        }
+        if (transformer != null) {
+            try {
+                StringWriter sw = new StringWriter();
+                transformer
+                        .transform(new DOMSource(node), new StreamResult(sw));
+                return sw.toString();
+            } catch (TransformerException te) {
+                throw new RuntimeException(te.getMessage());
+            }
+        }
+        return result;
+    }
 }

+ 1 - 1
airport/jeecg-boot-module-system/src/main/resources/jeecg/jeecg_config.properties

@@ -1,7 +1,7 @@
 #code_generate_project_path
 project_path=D:\\ls\\jeecg-boot
 #bussi_package[User defined]
-bussi_package=org.jeecg.modules.admin_post_record_item
+bussi_package=org.jeecg.modules
 
 
 #default code path

Some files were not shown because too many files changed in this diff