Просмотр исходного кода

:white_check_mark: 优化完成

Twelve615 1 год назад
Родитель
Сommit
59a7808469

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

@@ -105,7 +105,7 @@
                   afid IN (SELECT flight_afid FROM admin_aircraft_position WHERE flight_afid IS NOT NULL))
               GROUP BY cfno, position_code
               HAVING max(estr)) a
-        ORDER BY rstr ASC, flio ASC
+        ORDER BY flio ASC, rstr ASC
             ]]>
     </select>
 

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

@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.Wrapper;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.google.common.base.Strings;
@@ -998,7 +999,7 @@ public class APIController {
 //                baseCommonService.addLog( "用户校验失败,用户不存在!", CommonConstant.LOG_TYPE_1, null );
 //                return result;
 //            }
-            if (adminPostRecord.getTestType().equals("异常")) {
+//            if (adminPostRecord.getTestType().equals("异常")) {
                 //if (adminPostRecord.getTestPic() == null) {
                 //    result.setMessage("图片必传!!");
                 //    result.setCode(201);
@@ -1009,7 +1010,7 @@ public class APIController {
                 //    result.setCode(201);
                 //    return result;
                 //}
-            }
+            //}
             List<AdminPlatform> list = adminPlatformService.list();
             AdminPlatform adminPlatform = list.get(0);
 
@@ -1034,9 +1035,11 @@ public class APIController {
             }
 
             adminAircraftPositionService.updateById(byId);
-
-            adminPostRecord.setId(one1.getId());
-            adminPostRecord.setBeonDutyorNot(2);
+            LambdaUpdateWrapper<AdminPostRecord> adminPostRecordLambdaUpdateWrapper = new LambdaUpdateWrapper<>();
+            adminPostRecordLambdaUpdateWrapper.eq(AdminPostRecord::getId,one1.getId());
+            adminPostRecordLambdaUpdateWrapper.set(AdminPostRecord::getBeonDutyorNot,2);
+            //adminPostRecord.setId(one1.getId());
+            //adminPostRecord.setBeonDutyorNot(2);
             //判断是否有异常数据,有就将状态设为异常,没有就正常
 /*            QueryWrapper<AdminPostRecordItem> adminPostRecordItemQuseryWrapper = new QueryWrapper<AdminPostRecordItem>();
             adminPostRecordItemQuseryWrapper.eq("main_id", adminPostRecord.getId());
@@ -1048,9 +1051,25 @@ public class APIController {
             }*/
             if (adminPostRecord.getBeonDutyorNot() != null && adminPostRecord.getBeonDutyorNot().equals(2)) {
                 // 添加离岗时间
-                adminPostRecord.setLeaveTime(new Date());
+                //adminPostRecord.setLeaveTime(new Date());
+                adminPostRecordLambdaUpdateWrapper.set(AdminPostRecord::getLeaveTime,new Date());
+            }
+            // 离岗以机位上的数据为准
+            if (!Strings.isNullOrEmpty(one1.getAircraftPositionId())) {
+                AdminAircraftPosition byId1 = adminAircraftPositionService.getById(one1.getAircraftPositionId());
+                if (byId1 != null) {
+                    adminPostRecordLambdaUpdateWrapper.set(AdminPostRecord::getAircraftNum,byId1.getAircraftNum());
+                    adminPostRecordLambdaUpdateWrapper.set(AdminPostRecord::getFlightNum,byId1.getFlightNum());
+                }
             }
-            adminPostRecordService.updateById(adminPostRecord);
+            //adminPostRecordService.updateById(adminPostRecord);
+            adminPostRecordLambdaUpdateWrapper.set(AdminPostRecord::getTestType,adminPostRecord.getTestType());
+            adminPostRecordLambdaUpdateWrapper.set(AdminPostRecord::getTestContent,adminPostRecord.getTestContent());
+            adminPostRecordLambdaUpdateWrapper.set(AdminPostRecord::getTestPic,adminPostRecord.getTestPic());
+            adminPostRecordLambdaUpdateWrapper.set(AdminPostRecord::getLeaveTime,adminPostRecord.getLeaveTime());
+            adminPostRecordLambdaUpdateWrapper.set(AdminPostRecord::getRemark,adminPostRecord.getRemark());
+            adminPostRecordLambdaUpdateWrapper.set(AdminPostRecord::getSignaturePic,adminPostRecord.getSignaturePic());
+            adminPostRecordService.update(adminPostRecordLambdaUpdateWrapper);
             result.setMessage("提交岗位记录成功");
             result.setResult("提交岗位记录成功");
             result.setCode(200);
@@ -1439,17 +1458,7 @@ public class APIController {
         }
         if (initiateHandoverTO.getDropTime() == null) {
             // 获取过后还是空
-            LambdaQueryWrapper<AdminAircraftPosition> positionLambdaQueryWrapper = new LambdaQueryWrapper<AdminAircraftPosition>();
-            AdminAircraftPosition one1 = adminAircraftPositionService.getOne(positionLambdaQueryWrapper);
-            if (one1 != null) {
-                if (one1.getDropTime() != null) {
-                    initiateHandoverTO.setDropTime(one1.getDropTime());
-                } else if(one1.getPredictDropTime() != null) {
-                    initiateHandoverTO.setDropTime(one1.getPredictDropTime());
-                } else {
-                    initiateHandoverTO.setDropTime(new Date());
-                }
-            }
+            initiateHandoverTO.setDropTime(new Date());
         }
     }
 
@@ -1494,8 +1503,9 @@ public class APIController {
 
             //我记得好像安检和订单id是一样的
             AdminOrder byId1 = adminOrderService.getById(id);
+            Date qifeiTime = getQifeiTime(byId1);
             byId1.setType("交接结束");
-            byId1.setQifeiTime(new Date());
+            byId1.setQifeiTime(qifeiTime);
             byId1.setOverBy(one.getName());
             byId1.setOverById(one.getId());
             adminOrderService.updateById(byId1);
@@ -1512,6 +1522,26 @@ public class APIController {
         }
     }
 
+    /**
+     * 获取起飞时间
+     * @param byId1
+     * @return
+     */
+    private Date getQifeiTime(AdminOrder byId1) {
+        if (!Strings.isNullOrEmpty(byId1.getFlightSole())) {
+            AdminDfdlList dfdl = adminDfdlListService.getById(byId1.getFlightSole());
+            if (dfdl != null && dfdl.getFrtt() != null) {
+                return dfdl.getFrtt();
+            } else if (!Strings.isNullOrEmpty(byId1.getFlightAfid())) {
+                dfdl = adminDfdlListService.getById(byId1.getFlightSole());
+                if (dfdl != null && dfdl.getFrtt() != null) {
+                    return dfdl.getFrtt();
+                }
+            }
+        }
+        return new Date();
+    }
+
     @AutoLog(value = "小程序-手动恢复交接订单", operateType = CommonConstant.OPERATE_TYPE_3)
     @ApiOperation(value = "手动恢复订单(订单orderNum)", notes = "手动恢复订单(订单orderNum)")
     @PostMapping(value = "/recoveryTerminationOrder/{orderNum}")

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

@@ -90,7 +90,7 @@ public class AirportJob extends ImfMsgAbstract implements Job {
         boolean b = getAdminAircraftPositionService().updateBatchById(adminAircraftPositions);
         // 待交出订单 处理
         LambdaQueryWrapper<AdminOrder> queryWrapper = new LambdaQueryWrapper<>();
-        queryWrapper.eq(AdminOrder::getType, "待交出");
+        queryWrapper.ne(AdminOrder::getType, "交接结束");
         List<AdminOrder> adminOrderList = adminOrderService.list(queryWrapper);
         List<AdminOrder> orderList = Collections.synchronizedList(adminOrderList);
         List<AdminSecurityCheck> adminSecurityChecks = Collections.synchronizedList(new ArrayList<AdminSecurityCheck>());

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

@@ -1,8 +1,10 @@
 package org.jeecg.modules.api.imf.msg;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.google.common.base.Strings;
 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;
@@ -34,6 +36,7 @@ public class DepeImfMsg extends ImfMsgAbstract {
     }
 
     @Override
+    @Transactional
     public void handle() {
         // 根据起飞时间将机位置为空置,注意起飞时FLID是原进站的AFID
         String FLID = getStrVal("/MSG/DFLT/FLID");
@@ -49,6 +52,8 @@ public class DepeImfMsg extends ImfMsgAbstract {
                 byId.setFrtt(date);
                 byId.setDepe(1);
                 updateAdminDfdl(byId);
+                // 置空对应机位
+                restThePosition(byId.getPositionCode());
                 //判断起飞航班
                 if ("D".equals(byId.getFlio()) && byId.getAfid() != null) {
                     AdminDfdlList adminDfdlList = getAdminDfdl(String.valueOf(byId.getAfid()));
@@ -66,6 +71,23 @@ public class DepeImfMsg extends ImfMsgAbstract {
     }
 
     /**
+     * 空置机位
+     *
+     * @param positionCode
+     */
+    private void restThePosition(String positionCode) {
+        if (Strings.isNullOrEmpty(positionCode)) {
+            return;
+        }
+        LambdaQueryWrapper<AdminAircraftPosition> adminAircraftPositionLambdaQueryWrapper = new LambdaQueryWrapper<>();
+        adminAircraftPositionLambdaQueryWrapper.eq(AdminAircraftPosition::getAircraftPositionNum, positionCode);
+        AdminAircraftPosition one = getAdminAircraftPositionService().getOne(adminAircraftPositionLambdaQueryWrapper, false);
+        if (ImfMsgUtil.setNullPosition(one)) {
+            getAdminAircraftPositionService().updateById(one);
+        }
+    }
+
+    /**
      * flid对应机位起飞处理
      *
      * @param adminDfdlList FLID

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

@@ -1,6 +1,7 @@
 package org.jeecg.modules.api.imf.msg;
 
 import lombok.extern.slf4j.Slf4j;
+import org.jeecg.modules.admin_aircraft_position.entity.AdminAircraftPosition;
 import org.jetbrains.annotations.Nullable;
 
 import java.util.regex.Matcher;
@@ -74,4 +75,28 @@ public class ImfMsgUtil {
         return null;
     }
 
+
+    /**
+     * 设置机位上的数据为空
+     *
+     * @param adminAircraftPosition
+     */
+    public static boolean setNullPosition(AdminAircraftPosition adminAircraftPosition) {
+        if (adminAircraftPosition == null) return false;
+
+        adminAircraftPosition.setFlightSole(null);
+        adminAircraftPosition.setFlightAfid(null);
+        adminAircraftPosition.setFlightNum(null);
+        adminAircraftPosition.setAircraftNum(null);
+        adminAircraftPosition.setEstr(null);
+        adminAircraftPosition.setEend(null);
+        adminAircraftPosition.setRstr(null);
+        adminAircraftPosition.setRend(null);
+        adminAircraftPosition.setType("空置");
+        adminAircraftPosition.setDropTime(null);
+        adminAircraftPosition.setPredictDropTime(null);
+
+        return true;
+    }
+
 }

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

@@ -1,12 +1,20 @@
 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.google.common.base.Strings;
 import lombok.extern.slf4j.Slf4j;
+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_dfdl_list.entity.AdminDfdlList;
+import org.jeecg.modules.admin_security_check.entity.AdminSecurityCheck;
+import org.jeecg.modules.admin_security_check.service.IAdminSecurityCheckService;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.util.Collections;
 import java.util.Date;
+import java.util.List;
 
 /**
  * @author 王葆权
@@ -18,8 +26,11 @@ import java.util.Date;
 @Slf4j
 public class StlsImfMsg extends ImfMsgAbstract {
 
+    private IAdminSecurityCheckService adminSecurityCheckService;
+
     public StlsImfMsg(String xmlStr) {
         super(xmlStr, ImfMsgType.STLS);
+        adminSecurityCheckService = SpringContextUtils.getBean(IAdminSecurityCheckService.class);
     }
 
     /**
@@ -35,11 +46,30 @@ public class StlsImfMsg extends ImfMsgAbstract {
             // 没有的计划
             return;
         }
-        // 机位
-        //String CODE = getStrVal("/MSG/DFLT/STLS/STND/CODE");
-        //dfdlList.setPositionCode(CODE);
+        // 原机位
+        String positionCode = dfdlList.getPositionCode();
         // 计划时间
         setStlsStnd(dfdlList);
+        if (!Strings.isNullOrEmpty(positionCode) && !positionCode.equals(dfdlList.getPositionCode())) {
+            // 机位变更了,更新安检,更新机位
+            // 修改安检 根据机位
+            LambdaUpdateWrapper<AdminSecurityCheck> adminSecurityCheckLambdaUpdateWrapper1 = new LambdaUpdateWrapper<>();
+            adminSecurityCheckLambdaUpdateWrapper1.eq(AdminSecurityCheck::getAircraftPositionNum, positionCode);
+            // 修改安检
+            adminSecurityCheckLambdaUpdateWrapper1
+                    .set(AdminSecurityCheck::getAircraftNum, null)
+                    .set(AdminSecurityCheck::getDropTime, null)
+                    .set(AdminSecurityCheck::getFlightNum, null)
+                    .set(AdminSecurityCheck::getFlightSole, null)
+                    .set(AdminSecurityCheck::getFlightAfid, null);
+            adminSecurityCheckService.update(adminSecurityCheckLambdaUpdateWrapper1);
+            // 查询旧的机位并置空
+            AdminAircraftPosition one = getApByCode(positionCode);
+            if (ImfMsgUtil.setNullPosition(one)) {
+                getAdminAircraftPositionService().updateById(one);
+            }
+        }
+        // 更新计划
         updateAdminDfdl(dfdlList);
     }
 
@@ -53,7 +83,7 @@ public class StlsImfMsg extends ImfMsgAbstract {
         LambdaQueryWrapper<AdminAircraftPosition> adminAircraftPositionLambdaQueryWrapper = new LambdaQueryWrapper<>();
         adminAircraftPositionLambdaQueryWrapper.eq(AdminAircraftPosition::getAircraftPositionNum, CODE);
         // 通过机位查询到的数据
-        AdminAircraftPosition codeAircraftPosition = getAdminAircraftPositionService().getOne(adminAircraftPositionLambdaQueryWrapper);
+        AdminAircraftPosition codeAircraftPosition = getAdminAircraftPositionService().getOne(adminAircraftPositionLambdaQueryWrapper, false);
         return codeAircraftPosition;
     }
 

+ 3 - 2
airport/jeecg-boot-module-system/src/main/resources/application-local.yml

@@ -24,7 +24,8 @@ airport:
   mq:
     msgHandlerEvent: false
   system:
-    host: http://127.0.0.1:9999/airport
+#    host: http://192.168.2.88:9999/airport
+    host: http://twelve615.nat300.top/airport
     exportNum: 300
 spring:
 #  thymeleaf:
@@ -206,7 +207,7 @@ spring:
   #          driver-class-name: com.mysql.cj.jdbc.Driver
   #redis 配置
   redis:
-    database: 0
+    database: 6
     host: 120.79.86.50
     lettuce:
       pool: