Forráskód Böngészése

:white_check_mark:解决起飞删除订单问题,飞机离开机位就清空消息,增加备降航班

Twelve615 1 éve
szülő
commit
4ece82bdd3

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

@@ -148,6 +148,34 @@ public class AdminDfdlList {
 	@ApiModelProperty(value = "计划降落时间")
 	@TableField(updateStrategy = FieldStrategy.IGNORED)
 	private java.util.Date fplt;
+	/**备降预计起飞时间*/
+	@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 = "备降预计起飞时间")
+	@TableField(updateStrategy = FieldStrategy.IGNORED)
+	private java.util.Date dett;
+	/**备降实际起飞时间*/
+	@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 = "备降实际起飞时间")
+	@TableField(updateStrategy = FieldStrategy.IGNORED)
+	private java.util.Date drtt;
+	/**备降预计降落时间*/
+	@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 = "备降预计降落时间")
+	@TableField(updateStrategy = FieldStrategy.IGNORED)
+	private java.util.Date delt;
+	/**备降实际降落时间*/
+	@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 = "备降实际降落时间")
+	@TableField(updateStrategy = FieldStrategy.IGNORED)
+	private java.util.Date drlt;
 	/**updateTime*/
 	@Excel(name = "updateTime", width = 20, format = "yyyy-MM-dd HH:mm:ss")
 	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@@ -180,4 +208,8 @@ public class AdminDfdlList {
 	@Excel(name = "航班滑回标志位,0:正常,1:滑回", width = 15)
 	@ApiModelProperty(value = "航班滑回标志位,0:正常,1:滑回")
 	private java.lang.Integer bake;
+	/**航班备降标志位,0:正常,1:备降*/
+	@Excel(name = "航班备降标志位,0:正常,1:备降", width = 15)
+	@ApiModelProperty(value = "航班备降标志位,0:正常,1:备降")
+	private java.lang.Integer alte;
 }

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

@@ -26,9 +26,9 @@
                 AND position_code != ''
         AND arrival = 1
         AND flio = 'A'
-        AND IFNULL(IFNULL(frlt, IFNULL(felt, IFNULL(rstr, IFNULL(fplt, estr)))), DATE_ADD(CURDATE(), INTERVAL 1 DAY)) <=
+        AND IFNULL(IFNULL(IF(alte = 0, frlt, drlt), IFNULL(IF(alte = 0, felt, delt), IFNULL(rstr, IFNULL(fplt, estr)))), DATE_ADD(CURDATE(), INTERVAL 1 DAY)) <=
             date_format(#{date,jdbcType=TIMESTAMP}, '%Y-%m-%d %H:%i:%s.%f')
-        AND IFNULL(IFNULL(frtt, IFNULL(fett, IFNULL(rend, eend))), DATE_ADD(CURDATE(), INTERVAL 1 DAY)) >=
+        AND IFNULL(IFNULL(rend, IFNULL(IF(alte = 0, frtt, drtt), IFNULL(IF(alte = 0, fett, dett), eend))), DATE_ADD(CURDATE(), INTERVAL 1 DAY)) >=
             date_format(#{date,jdbcType=TIMESTAMP}, '%Y-%m-%d %H:%i:%s.%f')
         AND (depe != 1 OR depe IS NULL)
         AND del = 0
@@ -42,9 +42,9 @@
                 AND position_code != ''
                 AND flio = 'A'
                 AND rend IS NULL
-                AND IFNULL(IFNULL(frlt, IFNULL(felt, IFNULL(rstr, IFNULL(fplt, estr)))), DATE_ADD(CURDATE(), INTERVAL 1 DAY)) <=
+                AND IFNULL(IFNULL(IF(alte = 0, frlt, drlt), IFNULL(IF(alte = 0, felt, delt), IFNULL(rstr, IFNULL(fplt, estr)))), DATE_ADD(CURDATE(), INTERVAL 1 DAY)) <=
                   date_format(#{date,jdbcType=TIMESTAMP}, '%Y-%m-%d %H:%i:%s.%f')
-                AND IFNULL(IFNULL(frtt, IFNULL(fett, IFNULL(rend, eend))), DATE_ADD(CURDATE(), INTERVAL 1 DAY)) <=
+                AND IFNULL(IFNULL(rend, IFNULL(IF(alte = 0, frtt, drtt), IFNULL(IF(alte = 0, fett, dett), eend))), DATE_ADD(CURDATE(), INTERVAL 1 DAY)) <=
                   date_format(#{date,jdbcType=TIMESTAMP}, '%Y-%m-%d %H:%i:%s.%f')
                 AND (depe != 1 OR depe IS NULL)
                 AND del = 0
@@ -61,9 +61,9 @@
               WHERE position_code IS NOT NULL
                 AND position_code != ''
                 AND flio = 'D'
-                AND IFNULL(IFNULL(frlt, IFNULL(rstr, IFNULL(felt, IFNULL(fplt, estr)))), DATE_ADD(CURDATE(), INTERVAL 1 DAY)) <=
+                AND IFNULL(IFNULL(IF(alte = 0, frlt, drlt), IFNULL(rstr, IFNULL(IF(alte = 0, felt, delt), IFNULL(fplt, estr)))), DATE_ADD(CURDATE(), INTERVAL 1 DAY)) <=
                   date_format(#{date,jdbcType=TIMESTAMP}, '%Y-%m-%d %H:%i:%s.%f')
-                AND IFNULL(IFNULL(frtt, IFNULL(fett, IFNULL(rend, IFNULL(fptt, eend)))), DATE_ADD(CURDATE(), INTERVAL 1 DAY)) >=
+                AND IFNULL(IFNULL(rend, IFNULL(IF(alte = 0, frtt, drtt), IFNULL(IF(alte = 0, fett, dett), IFNULL(fptt, eend)))), DATE_ADD(CURDATE(), INTERVAL 1 DAY)) >=
                   date_format(#{date,jdbcType=TIMESTAMP}, '%Y-%m-%d %H:%i:%s.%f')
                 AND (depe != 1 OR depe IS NULL)
                 AND del = 0
@@ -76,9 +76,9 @@
               WHERE position_code IS NOT NULL
                 AND position_code != ''
                 AND flio = 'D'
-                AND IFNULL(IFNULL(frlt, IFNULL(rstr, IFNULL(felt, IFNULL(fplt, estr)))), DATE_ADD(CURDATE(), INTERVAL 1 DAY)) <=
+                AND IFNULL(IFNULL(IF(alte = 0, frlt, drlt), IFNULL(rstr, IFNULL(IF(alte = 0, felt, delt), IFNULL(fplt, estr)))), DATE_ADD(CURDATE(), INTERVAL 1 DAY)) <=
                   date_format(#{date,jdbcType=TIMESTAMP}, '%Y-%m-%d %H:%i:%s.%f')
-                AND IFNULL(IFNULL(frtt, IFNULL(fett, IFNULL(rend, IFNULL(fptt, eend)))), DATE_ADD(CURDATE(), INTERVAL 1 DAY)) >=
+                AND IFNULL(IFNULL(rend, IFNULL(IF(alte = 0, frtt, drtt), IFNULL(IF(alte = 0, fett, dett), IFNULL(fptt, eend)))), DATE_ADD(CURDATE(), INTERVAL 1 DAY)) >=
                   date_format(#{date,jdbcType=TIMESTAMP}, '%Y-%m-%d %H:%i:%s.%f')
                 AND (depe != 1 OR depe IS NULL)
                 AND afid IS NULL
@@ -92,9 +92,9 @@
               WHERE position_code IS NOT NULL
                 AND position_code != ''
                 AND flio = 'D'
-                AND IFNULL(IFNULL(frlt, IFNULL(rstr, IFNULL(felt, IFNULL(fplt, estr)))), DATE_ADD(CURDATE(), INTERVAL 1 DAY)) <=
+                AND IFNULL(IFNULL(IF(alte = 0, frlt, drlt), IFNULL(rstr, IFNULL(IF(alte = 0, felt, delt), IFNULL(fplt, estr)))), DATE_ADD(CURDATE(), INTERVAL 1 DAY)) <=
                   date_format(#{date,jdbcType=TIMESTAMP}, '%Y-%m-%d %H:%i:%s.%f')
-                AND IFNULL(IFNULL(frtt, IFNULL(fett, IFNULL(rend, IFNULL(fptt, eend)))), DATE_ADD(CURDATE(), INTERVAL 1 DAY)) <=
+                AND IFNULL(IFNULL(rend, IFNULL(IF(alte = 0, frtt, drtt), IFNULL(IF(alte = 0, fett, dett), IFNULL(fptt, eend)))), DATE_ADD(CURDATE(), INTERVAL 1 DAY)) <=
                   date_format(#{date,jdbcType=TIMESTAMP}, '%Y-%m-%d %H:%i:%s.%f')
                 AND (depe != 1 OR depe IS NULL)
                 AND del = 0

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

@@ -0,0 +1,40 @@
+package org.jeecg.modules.api.imf.msg;
+
+import com.google.common.base.Strings;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.modules.admin_dfdl_list.entity.AdminDfdlList;
+
+/**
+ * @author 王葆权
+ * @Title:
+ * @Package org.jeecg.modules.api.imf.msg
+ * @Description:
+ * @date 2023/8/30 9:49
+ */
+@Slf4j
+public class AlteImfMsg extends ImfMsgAbstract {
+    public AlteImfMsg(String xmlStr) {
+        super(xmlStr, ImfMsgType.ALTE);
+    }
+
+    @Override
+    protected void handle() {
+        String flid = getFlid();
+        if (Strings.isNullOrEmpty(flid)) {
+            log.error("未找到flid");
+            return;
+        }
+        AdminDfdlList dfdl = getAdminDfdlListService().getById(flid);
+        if (dfdl == null) {
+            log.error("未找到flid:{}对应的计划", flid);
+            return;
+        }
+        dfdl.setAlte(1);
+        dfdl.setDett(strToDate(getStrVal("/MSG/DFLT/DETT")));
+        dfdl.setDrtt(strToDate(getStrVal("/MSG/DFLT/DRTT")));
+        dfdl.setDelt(strToDate(getStrVal("/MSG/DFLT/DELT")));
+        dfdl.setDrlt(strToDate(getStrVal("/MSG/DFLT/DRLT")));
+        boolean b = getAdminDfdlListService().updateById(dfdl);
+        log.info("备降航班修改{}", b ? "成功" : "失败");
+    }
+}

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

@@ -98,31 +98,69 @@ public class DepeImfMsg extends ImfMsgAbstract {
         if (adminDfdlList != null) {
             log.info("航班已经起飞:{}", adminDfdlList);
             //还有改订单状态 删除安检信息
-            //照机位删除
+            //按照飞机信息删除
             LambdaQueryWrapper<AdminOrder> adminOrderLambdaQueryWrapper = new LambdaQueryWrapper<>();
-            adminOrderLambdaQueryWrapper.eq(AdminOrder::getAircraftPositionNum, adminDfdlList.getPositionCode())
-                    .ne(AdminOrder::getType, "交接结束");
+            adminOrderLambdaQueryWrapper.ne(AdminOrder::getType, "交接结束");
+            adminOrderLambdaQueryWrapper.eq(AdminOrder::getAircraftNum, adminDfdlList.getCfno())
+                    .or().eq(AdminOrder::getFlightSole, adminDfdlList.getFlid());
+            if (adminDfdlList.getAfid() != null && adminDfdlList.getAfid() > 0) {
+                adminOrderLambdaQueryWrapper.or().eq(AdminOrder::getFlightSole, adminDfdlList.getAfid());
+            }
             List<AdminOrder> list1 = adminOrderService.list(adminOrderLambdaQueryWrapper);
-            if (list1.size() != 0) {
-                for (int i = 0; i < list1.size(); i++) {
-                    AdminOrder adminOrder = list1.get(i);
-                    adminOrder.setType("交接结束");
-                    adminOrder.setQifeiTime(date);
-                    adminOrder.setOverBy("起飞结束");
-                    adminOrder.setOverById("系统");
-                    adminOrderService.updateById(adminOrder);
+            if (list1 != null && list1.size() > 0) {
+                closeOrder(date, list1);
+            } else {
+                // 没有按照飞机信息删除 则按照机位删除
+                adminOrderLambdaQueryWrapper.clear();
+                adminOrderLambdaQueryWrapper.eq(AdminOrder::getAircraftPositionNum, adminDfdlList.getPositionCode())
+                        .ne(AdminOrder::getType, "交接结束");
+                List<AdminOrder> adminOrderList = adminOrderService.list(adminOrderLambdaQueryWrapper);
+                if (list1 != null && list1.size() > 0){
+                    closeOrder(date, adminOrderList);
                 }
             }
             //删安检
             LambdaQueryWrapper<AdminSecurityCheck> adminSecurityCheckLambdaQueryWrapper = new LambdaQueryWrapper<>();
-            adminSecurityCheckLambdaQueryWrapper.eq(AdminSecurityCheck::getAircraftPositionNum, adminDfdlList.getPositionCode());
+            adminSecurityCheckLambdaQueryWrapper.eq(AdminSecurityCheck::getAircraftNum, adminDfdlList.getCfno())
+                    .or().eq(AdminSecurityCheck::getFlightSole, adminDfdlList.getFlid());
+            if (adminDfdlList.getAfid() != null && adminDfdlList.getAfid() > 0) {
+                adminSecurityCheckLambdaQueryWrapper.or().eq(AdminSecurityCheck::getFlightSole, adminDfdlList.getAfid());
+            }
             List<AdminSecurityCheck> list = adminSecurityCheckService.list(adminSecurityCheckLambdaQueryWrapper);
-            if (list.size() != 0) {
+            if (list != null && list.size() > 0) {
                 List<String> ids = list.stream()
                         .map(AdminSecurityCheck::getId)
                         .collect(Collectors.toList());
                 adminSecurityCheckService.removeByIds(ids);
+            } else {
+                // 通过飞机号等信息查不到,按照机位删除
+                adminSecurityCheckLambdaQueryWrapper.clear();
+                adminSecurityCheckLambdaQueryWrapper.eq(AdminSecurityCheck::getAircraftPositionNum, adminDfdlList.getPositionCode());
+                List<AdminSecurityCheck> adminSecurityCheckList = adminSecurityCheckService.list(adminSecurityCheckLambdaQueryWrapper);
+                if (adminSecurityCheckList != null && adminSecurityCheckList.size() > 0) {
+                    List<String> ids = adminSecurityCheckList.stream()
+                            .map(AdminSecurityCheck::getId)
+                            .collect(Collectors.toList());
+                    adminSecurityCheckService.removeByIds(ids);
+                }
             }
         }
     }
+
+    /**
+     * 关闭订单
+     * @param date
+     * @param list1
+     */
+    private void closeOrder(Date date, List<AdminOrder> list1) {
+        if(list1 == null) return;
+        for (int i = 0; i < list1.size(); i++) {
+            AdminOrder adminOrder = list1.get(i);
+            adminOrder.setType("交接结束");
+            adminOrder.setQifeiTime(date);
+            adminOrder.setOverBy("起飞结束");
+            adminOrder.setOverById("系统");
+            adminOrderService.updateById(adminOrder);
+        }
+    }
 }

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

@@ -30,6 +30,7 @@ public enum ImfMsgType {
     BAKE("BAKE", "航班滑回消息", "BAKE_"),
     DFUE("DFUE", "航班动态信息更新", "DFUE_"),
     AIRL("AIRL", "航班航线变更消息", "AIRL_"),
+    ALTE("ALTE", "航班备降消息", "ALTE_"),
     NONE("NONE", "空的消息", "NONE_");
     private final String name;
     private final String description;

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

@@ -69,6 +69,8 @@ public class ImfMsgUtil {
                 return new DfueImfMsg(xmlString);
             } else if (byName.getName().equals(ImfMsgType.AIRL.getName())) {
                 return new AirlImfMsg(xmlString);
+            } else if (byName.getName().equals(ImfMsgType.ALTE.getName())) {
+                return new AlteImfMsg(xmlString);
             }
         }
         log.error("未知的消息类型{}", byName);