Prechádzať zdrojové kódy

:white_check_mark: 同步机场消息时修改订单和安检

Twelve615 1 rok pred
rodič
commit
09f4c4a5e3

+ 8 - 3
airport/jeecg-boot-module-system/src/main/java/org/jeecg/modules/admin_order/entity/AdminOrder.java

@@ -3,9 +3,8 @@ package org.jeecg.modules.admin_order.entity;
 import java.io.Serializable;
 import java.io.UnsupportedEncodingException;
 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.*;
 import lombok.Data;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import org.springframework.format.annotation.DateTimeFormat;
@@ -37,6 +36,7 @@ public class AdminOrder implements Serializable {
 	/**飞机编号*/
 	@Excel(name = "飞机编号", width = 15)
     @ApiModelProperty(value = "飞机编号")
+    @TableField(updateStrategy = FieldStrategy.IGNORED)
     private String aircraftNum;
 	/**落地机位*/
 	@Excel(name = "落地机位", width = 15)
@@ -47,10 +47,12 @@ public class AdminOrder implements Serializable {
     @ApiModelProperty(value = "落地时间")
     @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
     @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    @TableField(updateStrategy = FieldStrategy.IGNORED)
     private Date dropTime;
 	/**航班号*/
 	@Excel(name = "航班号", width = 15)
     @ApiModelProperty(value = "航班号")
+    @TableField(updateStrategy = FieldStrategy.IGNORED)
     private String flightNum;
 	/**状态*/
 	@Excel(name = "状态", width = 15, dicCode = "ordertype")
@@ -86,14 +88,17 @@ public class AdminOrder implements Serializable {
     private Date updateTime;
 
     @ApiModelProperty(value = "航班唯一编号")
+    @TableField(updateStrategy = FieldStrategy.IGNORED)
     private String flightSole;
 
     @ApiModelProperty(value = "关联航班ID(起飞用)")
+    @TableField(updateStrategy = FieldStrategy.IGNORED)
     private String flightAfid;
 
     @ApiModelProperty(value = "发起结束的人编码")
     private String overById;
 
+
     @ApiModelProperty(value = "发起结束的人")
     private String overBy;
 }

+ 7 - 4
airport/jeecg-boot-module-system/src/main/java/org/jeecg/modules/admin_security_check/entity/AdminSecurityCheck.java

@@ -4,10 +4,8 @@ import java.io.Serializable;
 import java.io.UnsupportedEncodingException;
 import java.util.Date;
 import java.math.BigDecimal;
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
+
+import com.baomidou.mybatisplus.annotation.*;
 import lombok.Data;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import org.springframework.format.annotation.DateTimeFormat;
@@ -43,6 +41,7 @@ public class AdminSecurityCheck implements Serializable {
 	/**飞机编号*/
 	@Excel(name = "飞机编号", width = 15)
     @ApiModelProperty(value = "飞机编号")
+    @TableField(updateStrategy = FieldStrategy.IGNORED)
     private String aircraftNum;
 	/**机位*/
 	@Excel(name = "机位", width = 15)
@@ -53,10 +52,12 @@ public class AdminSecurityCheck implements Serializable {
     @ApiModelProperty(value = "落地时间")
     @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
     @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    @TableField(updateStrategy = FieldStrategy.IGNORED)
     private Date dropTime;
 	/**航班号*/
 	@Excel(name = "航班号", width = 15)
     @ApiModelProperty(value = "航班号")
+    @TableField(updateStrategy = FieldStrategy.IGNORED)
     private String flightNum;
 	/**状态*/
 	@Excel(name = "状态", width = 15, dicCode = "ajtype")
@@ -84,9 +85,11 @@ public class AdminSecurityCheck implements Serializable {
     private Date updateTime;
 
     @ApiModelProperty(value = "航班唯一编号")
+    @TableField(updateStrategy = FieldStrategy.IGNORED)
     private String flightSole;
 
     @ApiModelProperty(value = "关联航班ID(起飞用)")
+    @TableField(updateStrategy = FieldStrategy.IGNORED)
     private String flightAfid;
 
     @ApiModelProperty(value = "部门")

+ 58 - 7
airport/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/imf/AirportJob.java

@@ -1,21 +1,24 @@
 package org.jeecg.modules.api.imf;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.fasterxml.jackson.core.JsonProcessingException;
 import lombok.extern.slf4j.Slf4j;
+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_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.api.imf.msg.ImfMsgAbstract;
 import org.jeecg.modules.api.imf.msg.ImfMsgType;
 import org.jetbrains.annotations.NotNull;
 import org.quartz.Job;
 import org.quartz.JobExecutionContext;
 import org.quartz.JobExecutionException;
+import org.springframework.transaction.annotation.Transactional;
 
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
-import java.util.Vector;
-import java.util.stream.Collectors;
+import java.util.*;
 
 /**
  * @author 王葆权
@@ -28,12 +31,17 @@ import java.util.stream.Collectors;
 public class AirportJob extends ImfMsgAbstract implements Job {
 
     /**
-     * 空的xml消息,用来占位排除一些错误
+     * 空的xml消息,用来占位排除一些错误
      */
     private static String nullMsgXml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><MSG><META><SNDR></SNDR><RCVR/><REFE></REFE><SEQN></SEQN><DDTM></DDTM><TYPE></TYPE><STYP></STYP></META><DFLT><FLID></FLID><FFID></FFID><FLTK></FLTK><FATT></FATT><STLS><STND><STNO></STNO><CODE></CODE><ESTR></ESTR><EEND></EEND><RSTR></RSTR><REND/><CSSI/><BTSC/></STND></STLS></DFLT></MSG>";
 
+    private IAdminOrderService adminOrderService;
+    private IAdminSecurityCheckService adminSecurityCheckService;
+
     public AirportJob() {
         super(nullMsgXml, ImfMsgType.NONE);
+        adminOrderService = SpringContextUtils.getBean(IAdminOrderService.class);
+        adminSecurityCheckService = SpringContextUtils.getBean(IAdminSecurityCheckService.class);
     }
 
     @Override
@@ -50,6 +58,7 @@ public class AirportJob extends ImfMsgAbstract implements Job {
      * 3.查询当前机位表的所有飞机对应的任务,移除应该起飞的飞机
      */
     @Override
+    @Transactional
     protected synchronized void handle() {
         // 当前时间
         Date now = new Date();
@@ -79,11 +88,53 @@ public class AirportJob extends ImfMsgAbstract implements Job {
             }
         }
         boolean b = getAdminAircraftPositionService().updateBatchById(adminAircraftPositions);
-        if (b) {
+        // 待交出订单 处理
+        LambdaQueryWrapper<AdminOrder> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(AdminOrder::getType, "待交出");
+        List<AdminOrder> adminOrderList = adminOrderService.list(queryWrapper);
+        List<AdminOrder> orderList = Collections.synchronizedList(adminOrderList);
+        List<AdminSecurityCheck> adminSecurityChecks = Collections.synchronizedList(new ArrayList<AdminSecurityCheck>());
+        for (AdminOrder adminOrder : orderList) {
+            for (AdminAircraftPosition position : adminAircraftPositions) {
+                if (position.getAircraftPositionNum().equals(adminOrder.getAircraftPositionNum())) {
+                    // 同机位
+                    setPositionDataToOrder(adminOrder, position,adminSecurityChecks);
+                }
+            }
+        }
+        boolean o = adminOrderService.updateBatchById(orderList);
+        boolean s = adminSecurityCheckService.updateBatchById(adminSecurityChecks);
+        if (b && o && s) {
             log.info("更新机位成功!");
+        } else {
+            log.info("机位更新{},订单更新{},安检更新{}。", b ? "成功" : "失败", o ? "成功" : "失败", s ? "成功" : "失败");
         }
     }
 
+    /**
+     * 设置机位数据到待交出订单
+     *
+     * @param adminOrder          订单
+     * @param position            机位
+     * @param adminSecurityChecks
+     */
+    private void setPositionDataToOrder(AdminOrder adminOrder, AdminAircraftPosition position, List<AdminSecurityCheck> adminSecurityChecks) {
+        adminOrder.setAircraftNum(position.getAircraftNum());
+        adminOrder.setDropTime(position.getDropTime());
+        adminOrder.setFlightNum(position.getFlightNum());
+        adminOrder.setFlightSole(position.getFlightSole());
+        adminOrder.setFlightAfid(position.getFlightAfid());
+        // 安检
+        AdminSecurityCheck adminSecurityCheck = new AdminSecurityCheck();
+        adminSecurityCheck.setId(adminOrder.getId());
+        adminSecurityCheck.setAircraftNum(adminOrder.getAircraftNum());
+        adminSecurityCheck.setDropTime(adminOrder.getDropTime());
+        adminSecurityCheck.setFlightNum(adminOrder.getFlightNum());
+        adminSecurityCheck.setFlightSole(adminOrder.getFlightSole());
+        adminSecurityCheck.setFlightAfid(adminOrder.getFlightAfid());
+        adminSecurityChecks.add(adminSecurityCheck);
+    }
+
     private void setNullPosition(AdminAircraftPosition adminAircraftPosition) {
         adminAircraftPosition.setFlightSole(null);
         adminAircraftPosition.setFlightAfid(null);