|
@@ -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);
|