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

:white_check_mark: 机位数据查询逻辑修改

Twelve615 1 éve
szülő
commit
4b8cec16a4

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

@@ -2,10 +2,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">
 
-    <select id="queryPermitAirplaneByDate" parameterType="date" resultType="org.jeecg.modules.admin_dfdl_list.entity.AdminDfdlList">
-        <![CDATA[
-        SELECT *
-        FROM (SELECT *
+    <!--
+    SELECT *
               FROM admin_dfdl_list
               WHERE position_code IS NOT NULL
                 AND position_code != ''
@@ -18,6 +16,11 @@
               GROUP BY cfno, position_code
               HAVING max(estr)
               UNION
+    -->
+    <select id="queryPermitAirplaneByDate" parameterType="date" resultType="org.jeecg.modules.admin_dfdl_list.entity.AdminDfdlList">
+        <![CDATA[
+        SELECT *
+        FROM (
               SELECT *
               FROM admin_dfdl_list
               WHERE position_code IS NOT NULL

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

@@ -3,6 +3,7 @@ package org.jeecg.modules.api.controller;
 
 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.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -32,6 +33,8 @@ import org.jeecg.modules.admin_airbridge_test.service.IAdminAirbridgeTestService
 import org.jeecg.modules.admin_aircraft_position.entity.AdminAircraftPosition;
 import org.jeecg.modules.admin_aircraft_position.entity.AdminAircraftPositionR;
 import org.jeecg.modules.admin_aircraft_position.service.IAdminAircraftPositionService;
+import org.jeecg.modules.admin_dfdl_list.entity.AdminDfdlList;
+import org.jeecg.modules.admin_dfdl_list.service.IAdminDfdlListService;
 import org.jeecg.modules.admin_dfdl_mq.entity.AdminDfdlMq;
 import org.jeecg.modules.admin_edit_message.entity.AdminEditMessage;
 import org.jeecg.modules.admin_edit_message.service.IAdminEditMessageService;
@@ -114,14 +117,17 @@ public class APIController {
     @Autowired
     private IAdminPostRecordItemService adminPostRecordItemService;
 
+    @Autowired
+    private IAdminDfdlListService adminDfdlListService;
+
     @PostMapping(value = "/sredis")
     public void sredis(@RequestBody String str) {
-        redisUtil.set( "DFDL", str );
+        redisUtil.set("DFDL", str);
     }
 
     @GetMapping(value = "/getDfdl")
-    public Result<String>  getDfdl() {
-        Result<String> dfdl = Result.OK((String)redisUtil.get("DFDL"));
+    public Result<String> getDfdl() {
+        Result<String> dfdl = Result.OK((String) redisUtil.get("DFDL"));
         return dfdl;
     }
 
@@ -681,7 +687,7 @@ public class APIController {
     @PostMapping(value = "/submitToPost")
     @Transactional
     public synchronized Result<String> submitToPost(@RequestHeader("Authorization") String Authorization,
-                                       @RequestBody AdminPostRecord adminPostRecord) {
+                                                    @RequestBody AdminPostRecord adminPostRecord) {
         Result<String> result = new Result<String>();
         if (Authorization.equals("")) {
             result.setMessage("token不能为空");
@@ -727,7 +733,7 @@ public class APIController {
 
             AdminAircraftPosition byId = adminAircraftPositionService.getById(adminPostRecord.getAircraftPositionId());
             if (byId.getAttendance() == null) {
-                if (adminPlatform.getAttendance() <= 0){
+                if (adminPlatform.getAttendance() <= 0) {
                     String format = String.format("已到最大到岗人数限制%d人", adminPlatform.getAttendance());
                     result.setMessage(format);
                     result.setResult(format);
@@ -736,7 +742,7 @@ public class APIController {
                 }
                 byId.setAttendance(1);
             } else {
-                if (adminPlatform.getAttendance() <= byId.getAttendance()){
+                if (adminPlatform.getAttendance() <= byId.getAttendance()) {
                     String format = String.format("已到最大到岗人数限制%d人", adminPlatform.getAttendance());
                     result.setMessage(format);
                     result.setResult(format);
@@ -773,7 +779,7 @@ public class APIController {
      * @return
      */
     @AutoLog(value = "小程序-岗位异常信息-添加", operateType = CommonConstant.OPERATE_TYPE_2)
-    @ApiOperation(value="岗位异常信息-添加", notes="岗位异常信息-添加")
+    @ApiOperation(value = "岗位异常信息-添加", notes = "岗位异常信息-添加")
     @PostMapping(value = "/addAdminPostRecordItem")
     public Result<?> add(@RequestHeader("Authorization") String Authorization, @RequestBody AdminPostRecordItem adminPostRecordItem) {
         Result<AdminPostRecordItem> result = new Result<AdminPostRecordItem>();
@@ -801,11 +807,11 @@ public class APIController {
             baseCommonService.addLog("用户校验失败,用户不存在!", CommonConstant.LOG_TYPE_1, null);
             return result;
         }
-        if(Strings.isNullOrEmpty(adminPostRecordItem.getMainId())) {
+        if (Strings.isNullOrEmpty(adminPostRecordItem.getMainId())) {
             result.setMessage("岗位id不能为空");
             return result;
         }
-        if(Strings.isNullOrEmpty(adminPostRecordItem.getTestType())) {
+        if (Strings.isNullOrEmpty(adminPostRecordItem.getTestType())) {
             result.setMessage("状态不能为空");
             return result;
         }
@@ -815,7 +821,7 @@ public class APIController {
     }
 
     @AutoLog(value = "小程序-岗位异常信息分页列表查询", operateType = CommonConstant.OPERATE_TYPE_1)
-    @ApiOperation(value="岗位异常信息-分页列表查询", notes="岗位异常信息-分页列表查询")
+    @ApiOperation(value = "岗位异常信息-分页列表查询", notes = "岗位异常信息-分页列表查询")
     @GetMapping(value = "/listAdminPostRecordItem")
     public Result<?> queryPageList(@RequestHeader("Authorization") String Authorization, AdminPostRecordItem adminPostRecordItem,
                                    HttpServletRequest req) {
@@ -844,7 +850,7 @@ public class APIController {
             return result;
         }
 
-        if(adminPostRecordItem == null || Strings.isNullOrEmpty(adminPostRecordItem.getMainId())) {
+        if (adminPostRecordItem == null || Strings.isNullOrEmpty(adminPostRecordItem.getMainId())) {
             result.setMessage("mainId不能为空");
             baseCommonService.addLog("mainId不能为空", CommonConstant.OPERATE_TYPE_1, null);
             return result;
@@ -891,10 +897,11 @@ public class APIController {
             queryWrapper2.eq("submitter", name);
 
             //这样取一个可能有点问题
-            AdminPostRecord one1 = adminPostRecordService.getOne(queryWrapper2);
-            if (one1 != null) {
+
+            List<AdminPostRecord> list = adminPostRecordService.list(queryWrapper2);
+            if (list != null && list.size() > 0) {
                 result.setMessage("到岗");
-                result.setResult(one1);
+                result.setResult(list.get(0));
             } else {
                 result.setMessage("离岗或者没有到岗");
                 result.setResult(null);
@@ -965,7 +972,7 @@ public class APIController {
     @PostMapping(value = "/setAdminPostRecord")
     @Transactional
     public synchronized Result<String> setAdminPostRecord(@RequestHeader("Authorization") String Authorization,
-                                             @RequestBody AdminPostRecord adminPostRecord) {
+                                                          @RequestBody AdminPostRecord adminPostRecord) {
         Result<String> result = new Result<String>();
         if (Authorization.equals("")) {
             result.setMessage("token不能为空");
@@ -1337,6 +1344,8 @@ public class APIController {
 //            创建安检还有订单
             SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
             String orderNum = initiateHandoverTO.getAircraftPositionNum() + sdf.format(new Date());
+            //设置降落时间
+            checkDropTime(initiateHandoverTO);
 
             AdminSecurityCheck adminSecurityCheck = new AdminSecurityCheck();
             adminSecurityCheck.setOrderNum(orderNum);
@@ -1378,6 +1387,45 @@ public class APIController {
         }
     }
 
+    /**
+     * 检查飞机降落时间是否存在
+     * 不存在则设置降落时间
+     * @param initiateHandoverTO
+     */
+    private void checkDropTime(InitiateHandoverTO initiateHandoverTO) {
+        if (initiateHandoverTO.getDropTime() == null) {
+            // 查询相关的计划
+            if (!Strings.isNullOrEmpty(initiateHandoverTO.getFlightSole())) {
+                AdminDfdlList byId = adminDfdlListService.getById(initiateHandoverTO.getFlightSole());
+                if (byId != null && byId.getFrlt() != null) {
+                    initiateHandoverTO.setDropTime(byId.getFrlt());
+                    return;
+                }
+            }
+            if (!Strings.isNullOrEmpty(initiateHandoverTO.getFlightAfid())) {
+                AdminDfdlList byId = adminDfdlListService.getById(initiateHandoverTO.getFlightAfid());
+                if (byId != null && byId.getFrlt() != null) {
+                    initiateHandoverTO.setDropTime(byId.getFrlt());
+                    return;
+                }
+            }
+        }
+        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());
+                }
+            }
+        }
+    }
+
     @AutoLog(value = "小程序-手动关闭交接订单", operateType = CommonConstant.OPERATE_TYPE_3)
     @ApiOperation(value = "手动结束订单(安检id)", notes = "手动结束订单(安检id)")
     @PostMapping(value = "/manual_termination_order/{id}")
@@ -1485,7 +1533,7 @@ public class APIController {
                 .eq("aircraft_num", adminOrder.getAircraftNum())
                 //.eq("drop_time", adminOrder.getDropTime())
                 .eq("flight_sole", adminOrder.getFlightSole())
-                .eq("flight_num",adminOrder.getFlightNum())
+                .eq("flight_num", adminOrder.getFlightNum())
         ;
         AdminAircraftPosition adminAircraftPosition = adminAircraftPositionService.getOne(adminAircaftQueryWarpper);
         if (adminAircraftPosition == null || Strings.isNullOrEmpty(adminAircraftPosition.getAircraftNum())) {
@@ -1719,16 +1767,16 @@ public class APIController {
                 AdminOrder adminOrder = adminOrderService.getById(adminOrderExamine.getOrderId());
                 adminOrder.setType("待接收");
 ////                这里要判断订单里的飞机号航班号是否为空  为空的话
-                adminOrder.setAircraftNum( adminOrderExamine.getAircraftNum() );
-                adminOrder.setAircraftPositionNum( adminOrderExamine.getAircraftPositionNum() );
-                adminOrder.setFlightNum( adminOrderExamine.getFlightNum() );
+                adminOrder.setAircraftNum(adminOrderExamine.getAircraftNum());
+                adminOrder.setAircraftPositionNum(adminOrderExamine.getAircraftPositionNum());
+                adminOrder.setFlightNum(adminOrderExamine.getFlightNum());
                 adminOrderService.updateById(adminOrder);
 
                 AdminSecurityCheck adminSecurityCheck = adminSecurityCheckService.getById(adminOrderExamine.getOrderId());
                 adminSecurityCheck.setType("待接收");
-                adminSecurityCheck.setAircraftNum( adminOrderExamine.getAircraftNum() );
-                adminSecurityCheck.setAircraftPositionNum( adminOrderExamine.getAircraftPositionNum() );
-                adminSecurityCheck.setFlightNum( adminOrderExamine.getFlightNum() );
+                adminSecurityCheck.setAircraftNum(adminOrderExamine.getAircraftNum());
+                adminSecurityCheck.setAircraftPositionNum(adminOrderExamine.getAircraftPositionNum());
+                adminSecurityCheck.setFlightNum(adminOrderExamine.getFlightNum());
                 adminSecurityCheckService.updateById(adminSecurityCheck);
                 result.setMessage("交出成功");
                 result.setResult("交出成功");
@@ -1736,18 +1784,18 @@ public class APIController {
             if (adminOrderExamine.getJiaochuOrJieshou().equals("接收")) {
                 AdminOrder adminOrder = adminOrderService.getById(adminOrderExamine.getOrderId());
                 adminOrder.setType("待交出");
-                adminOrder.setAircraftNum( adminOrderExamine.getAircraftNum() );
-                adminOrder.setAircraftPositionNum( adminOrderExamine.getAircraftPositionNum() );
-                adminOrder.setFlightNum( adminOrderExamine.getFlightNum() );
+                adminOrder.setAircraftNum(adminOrderExamine.getAircraftNum());
+                adminOrder.setAircraftPositionNum(adminOrderExamine.getAircraftPositionNum());
+                adminOrder.setFlightNum(adminOrderExamine.getFlightNum());
                 adminOrder.setType("待交出");
                 adminOrder.setType("待交出");
                 adminOrderService.updateById(adminOrder);
 
                 AdminSecurityCheck adminSecurityCheck = adminSecurityCheckService.getById(adminOrderExamine.getOrderId());
                 adminSecurityCheck.setType("待交出");
-                adminSecurityCheck.setAircraftNum( adminOrderExamine.getAircraftNum() );
-                adminSecurityCheck.setAircraftPositionNum( adminOrderExamine.getAircraftPositionNum() );
-                adminSecurityCheck.setFlightNum( adminOrderExamine.getFlightNum() );
+                adminSecurityCheck.setAircraftNum(adminOrderExamine.getAircraftNum());
+                adminSecurityCheck.setAircraftPositionNum(adminOrderExamine.getAircraftPositionNum());
+                adminSecurityCheck.setFlightNum(adminOrderExamine.getFlightNum());
                 adminSecurityCheckService.updateById(adminSecurityCheck);
                 result.setMessage("接收成功");
                 result.setResult("接收成功");

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

@@ -63,10 +63,11 @@ public class ImfMqListener extends BaseRabbiMqHandler<Object> {
             public void handler(Message message2, Channel channel) {
                 String xml = new String(message2.getBody(), StandardCharsets.UTF_8);
                 if (!Strings.isNullOrEmpty(xml)) {
+                    log.info("消息内容:{}", xml);
                     ImfMsg imfMsgObject = ImfMsgUtil.getImfMsgObject(xml);
                     if (imfMsgObject != null) {
                         log.info(">>>>>>>>>>>>>>>>>>>>开始处理消息<<<<<<<<<<<<<<<<<<<<");
-                        log.info("获取到消息。消息类型:{},消息内容:{}", imfMsgObject.getTypeName(), xml);
+                        log.info("获取到消息。消息类型:{}", imfMsgObject.getTypeName());
                         // 处理消息
                         imfMsgObject.process();
                         log.info(">>>>>>>>>>>>>>>>>>>>结束处理消息<<<<<<<<<<<<<<<<<<<<");